-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HTML: Add <source media> to media elements
See whatwg/html#9341
- Loading branch information
Showing
4 changed files
with
48 additions
and
51 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
...media-elements/loading-the-media-resource/resource-selection-source-media-env-change.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!doctype html> | ||
<title>the <source> media attribute: no reaction to environment change</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<div id=log></div> | ||
<iframe src="resources/media-min-width.html" width="300"></iframe> | ||
<script> | ||
const t = promise_test(async () => { | ||
await new Promise(resolve => window.onload = resolve); | ||
assert_equals(window[0].beforeEnvChange, '#a', 'beforeEnvChange'); | ||
assert_equals(window[0].afterEnvChange, '#a', 'afterEnvChange'); | ||
assert_equals(window[0].afterLoadCalled, '#b', 'afterLoadCalled'); | ||
}); | ||
</script> |
8 changes: 4 additions & 4 deletions
8
...ed-content/media-elements/loading-the-media-resource/resource-selection-source-media.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
<!doctype html> | ||
<title>the <source> media attribute has no effect</title> | ||
<title>the <source> media attribute</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<div id=log></div> | ||
<video><source src="resources/delayed-broken-video.py" media="none"></video> | ||
<video><source src="resources/delayed-broken-video.py" media="not all"></video> | ||
<script> | ||
test(function() { | ||
var v = document.querySelector('video'); | ||
var s = document.querySelector('source'); | ||
assert_equals(v.networkState, v.NETWORK_LOADING); | ||
assert_equals(v.currentSrc, s.src); | ||
assert_equals(v.networkState, v.NETWORK_NO_SOURCE); | ||
assert_equals(v.currentSrc, ''); | ||
}); | ||
</script> |
30 changes: 30 additions & 0 deletions
30
...embedded-content/media-elements/loading-the-media-resource/resources/media-min-width.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!DOCTYPE html> | ||
<video></video> | ||
<script> | ||
function createSource(src, media) { | ||
var source = document.createElement('source'); | ||
source.src = src; | ||
if (media) { | ||
source.media = media; | ||
} | ||
return source; | ||
} | ||
const rAF = () => new Promise(resolve => requestAnimationFrame(resolve)); | ||
const hash = str => str.substr(str.lastIndexOf('#')); | ||
(async () => { | ||
const v = document.querySelector('video'); | ||
v.append(createSource('delayed-broken-video.py#a', '(min-width: 200px)')); | ||
v.append(createSource('delayed-broken-video.py#b')); | ||
await rAF(); | ||
await rAF(); | ||
window.beforeEnvChange = hash(v.currentSrc); | ||
window.frameElement.width = '150'; | ||
await rAF(); | ||
await rAF(); | ||
window.afterEnvChange = hash(v.currentSrc); | ||
v.load() | ||
await rAF(); | ||
await rAF(); | ||
window.afterLoadCalled = hash(v.currentSrc); | ||
})(); | ||
</script> |
47 changes: 0 additions & 47 deletions
47
html/semantics/embedded-content/media-elements/video_008.htm
This file was deleted.
Oops, something went wrong.