-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MSE] If src attribute is defined, ignore source alternative
https://bugs.webkit.org/show_bug.cgi?id=274195 rdar://128098363 Reviewed by Youenn Fablet and Eric Carlson. Per spec, if a media element has a src attribute defined, `<source>` alternative are ignored. As such we should ignore the presence of the source children if a src attribute is set to determine if the ManagedMediaSource is in open state. * LayoutTests/media/media-source/media-managedmse-airplay-expected.txt: * LayoutTests/media/media-source/media-managedmse-airplay-withsrc-expected.txt: Added. * LayoutTests/media/media-source/media-managedmse-airplay-withsrc.html: Copied from LayoutTests/media/media-source/media-managedmse-airplay.html. * LayoutTests/media/media-source/media-managedmse-airplay.html: * LayoutTests/platform/glib/TestExpectations: * LayoutTests/platform/ios/TestExpectations: * Source/WebCore/html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::hasWirelessPlaybackTargetAlternative const): Canonical link: https://commits.webkit.org/278834@main
- Loading branch information
Showing
7 changed files
with
117 additions
and
11 deletions.
There are no files selected for viewing
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
18 changes: 18 additions & 0 deletions
18
LayoutTests/media/media-source/media-managedmse-airplay-withsrc-expected.txt
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,18 @@ | ||
|
||
RUN(source = new ManagedMediaSource()) | ||
RUN(url = URL.createObjectURL(source)) | ||
RUN(video.src = url) | ||
RUN(sourceElement1 = document.createElement("source")) | ||
RUN(sourceElement1.src = url) | ||
RUN(video.appendChild(sourceElement1)) | ||
RUN(sourceElement2 = document.createElement("source")) | ||
RUN(sourceElement2.src = "http://foo.com/playlist.m3u8") | ||
RUN(sourceElement2.type = "application/vnd.apple.mpegurl") | ||
RUN(video.appendChild(sourceElement2)) | ||
RUN(video.load()) | ||
RUN(video.removeAttribute("src")) | ||
RUN(video.load()) | ||
RUN(sourceOpenAllowed = true) | ||
EVENT(sourceopen) | ||
END OF TEST | ||
|
75 changes: 75 additions & 0 deletions
75
LayoutTests/media/media-source/media-managedmse-airplay-withsrc.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,75 @@ | ||
<!DOCTYPE html> <!-- webkit-test-runner [ ManagedMediaSourceEnabled=true MediaSourceEnabled=true ] --> | ||
<html> | ||
<head> | ||
<title>managedmediasource-airplay</title> | ||
<script src="../../media/media-source/media-source-loader.js"></script> | ||
<script src="../../media/video-test.js"></script> | ||
<script src="../../media/utilities.js"></script> | ||
<script> | ||
var loader; | ||
var source; | ||
var sourceBuffer; | ||
var sourceElement1; | ||
var sourceElement2; | ||
var sourceOpenAllowed = false; | ||
var url; | ||
|
||
function loaderPromise(loader) { | ||
return new Promise((resolve, reject) => { | ||
loader.onload = resolve; | ||
loader.onerror = reject; | ||
}); | ||
} | ||
|
||
window.addEventListener('load', async event => { | ||
try { | ||
findMediaElement(); | ||
|
||
let manifests = [ 'content/test-opus-manifest.json', 'content/test-vorbis-manifest.json', 'content/test-48khz-manifest.json', 'content/test-xhe-aac-manifest.json' ]; | ||
for (const manifest of manifests) { | ||
loader = new MediaSourceLoader(manifest); | ||
await loaderPromise(loader); | ||
if (ManagedMediaSource.isTypeSupported(loader.type())) | ||
break; | ||
} | ||
|
||
waitFor(video, 'error').then(failTest); | ||
|
||
run('source = new ManagedMediaSource()'); | ||
waitFor(source, 'sourceopen').then(() => { | ||
if (!sourceOpenAllowed) | ||
failTest() | ||
endTest(); | ||
}); | ||
|
||
run('url = URL.createObjectURL(source)'); | ||
run('video.src = url'); | ||
await sleepFor(100); | ||
|
||
run('sourceElement1 = document.createElement("source")'); | ||
run('sourceElement1.src = url'); | ||
run('video.appendChild(sourceElement1)'); | ||
|
||
await sleepFor(100); | ||
|
||
run('sourceElement2 = document.createElement("source")'); | ||
run('sourceElement2.src = "http://foo.com/playlist.m3u8"'); | ||
run('sourceElement2.type = "application/vnd.apple.mpegurl"'); | ||
run('video.appendChild(sourceElement2)'); | ||
run('video.load()'); | ||
|
||
await sleepFor(100); | ||
run('video.removeAttribute("src")'); | ||
run('video.load()'); | ||
|
||
run('sourceOpenAllowed = true'); | ||
} catch (e) { | ||
failTest(`Caught exception: "${e}"`); | ||
} | ||
}); | ||
</script> | ||
</head> | ||
<body> | ||
<video controls></video> | ||
</body> | ||
</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
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
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
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