-
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.
Cherry-pick c0a2b30. rdar://124079735
<audio> and <video> loadeddata events not fired on page load https://bugs.webkit.org/show_bug.cgi?id=270837 rdar://124079735 Reviewed by Eric Carlson. The HTMLMediaElement would call MediaPlayer::prepareToPlay() on the first MediaPlayerPrivate created which may not be the one we end up using. The code assumed that as soon as a MediaPlayer was created, we could call prepareToPlay on it which in the case of the MediaPlayerPrivateAVFobjC would start loading the content. Since we enabled the WebM player, the assumption no longer applied, multiple players could be used until we find one that can play the content. If the GPU process was enabled, the behaviour was racy as the GPUP's MediaPlayer may not have been created yet. The site would set a HTMLMediaElement's source to a mp3 file, without using an explicit extension nor having the server provide the mime-type. As such, we have to try in succession all MediaPlayerPrivate until we can find one that can load the content. We cache the call to prepareToPlay() and re-issue it on all new MediaPlayerPrivate once created. Added test. * LayoutTests/http/tests/media/audio-load-loadeddata-expected.txt: Added. * LayoutTests/http/tests/media/audio-load-loadeddata.html: Added. * LayoutTests/platform/ios/TestExpectations: All media tests are disabled on iOS, force this one to run. * Source/WebCore/platform/graphics/MediaPlayer.cpp: (WebCore::MediaPlayer::loadWithNextMediaEngine): (WebCore::MediaPlayer::prepareToPlay): * Source/WebCore/platform/graphics/MediaPlayer.h: * Source/WebCore/platform/graphics/MediaPlayerPrivate.h: (WebCore::MediaPlayerPrivateInterface::prepareForPlayback): * Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp: (WebKit::RemoteMediaPlayerProxy::prepareForPlayback): * Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.h: * Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.messages.in: * Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::prepareForPlayback): * Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.h: Canonical link: https://commits.webkit.org/275997@main Canonical link: https://commits.webkit.org/272448.891@safari-7618-branch
- Loading branch information
Showing
11 changed files
with
46 additions
and
9 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
LayoutTests/http/tests/media/audio-load-loadeddata-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,7 @@ | ||
|
||
RUN(video.muted = true) | ||
RUN(video.src = '/media/resources/load-video.py?type=audio/mpeg&name=sound_5.mp3') | ||
RUN(video.load()) | ||
EVENT(loadeddata) | ||
END OF TEST | ||
|
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,23 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>audio-load-loadeddata</title> | ||
<script src=../../media-resources/video-test.js></script> | ||
|
||
<script> | ||
function runTest() | ||
{ | ||
video = document.getElementsByTagName('audio')[0]; | ||
waitFor(video, 'loadeddata').then(() => endTest()); | ||
run("video.muted = true"); | ||
run(`video.src = '/media/resources/load-video.py?type=audio/mpeg&name=sound_5.mp3'`); | ||
run("video.load()"); | ||
} | ||
</script> | ||
</head> | ||
|
||
<body onload="runTest()"> | ||
<audio controls muted></audio> | ||
</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
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
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