Title: [291118] trunk
- Revision
- 291118
- Author
- [email protected]
- Date
- 2022-03-10 10:22:41 -0800 (Thu, 10 Mar 2022)
Log Message
[iOS] Netflix.com fails to resume after moving app to background during playback
https://bugs.webkit.org/show_bug.cgi?id=237659
<rdar://88775037>
Reviewed by Eric Carlson.
Source/WebCore:
Test: media/media-source/media-source-interruption-with-resume-allowing-play.html
When the MediaPlayerPrivateMediaSourceAVFObjC player is asked to play or pause, it notifies
the client (HTMLMediaElement) that its playback state has changed. HTMLMediaElement will in response
call playInternal() or pauseInternal() to ensure that a state change driven by the MediaPlayer
is reflected up to the DOM. However, when an interruption causes the media element to suspend
and pause playback, this results in an additional call to pauseInternal(), which updates the
"state to resume" after an interruption ends to "Paused".
In mediaPlayerPlaybackStateChanged(), only call pauseInternal() or playInternal() if the reported
player state does not match the HTMLMediaElement's own state.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaPlayerPlaybackStateChanged):
LayoutTests:
* media/media-source/media-source-interruption-with-resume-allowing-play-expected.txt: Added.
* media/media-source/media-source-interruption-with-resume-allowing-play.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (291117 => 291118)
--- trunk/LayoutTests/ChangeLog 2022-03-10 17:58:40 UTC (rev 291117)
+++ trunk/LayoutTests/ChangeLog 2022-03-10 18:22:41 UTC (rev 291118)
@@ -1,3 +1,14 @@
+2022-03-10 Jer Noble <[email protected]>
+
+ [iOS] Netflix.com fails to resume after moving app to background during playback
+ https://bugs.webkit.org/show_bug.cgi?id=237659
+ <rdar://88775037>
+
+ Reviewed by Eric Carlson.
+
+ * media/media-source/media-source-interruption-with-resume-allowing-play-expected.txt: Added.
+ * media/media-source/media-source-interruption-with-resume-allowing-play.html: Added.
+
2022-03-10 Philippe Normand <[email protected]>
REGRESSION(r284711): [GStreamer] Buffering, seek broken on youtube.com
Added: trunk/LayoutTests/media/media-source/media-source-interruption-with-resume-allowing-play-expected.txt (0 => 291118)
--- trunk/LayoutTests/media/media-source/media-source-interruption-with-resume-allowing-play-expected.txt (rev 0)
+++ trunk/LayoutTests/media/media-source/media-source-interruption-with-resume-allowing-play-expected.txt 2022-03-10 18:22:41 UTC (rev 291118)
@@ -0,0 +1,20 @@
+This tests that a video element sucessfully resumes playback after an interruption.
+
+RUN(video.src = ""
+EVENT(sourceopen)
+RUN(source.duration = loader.duration())
+RUN(sourceBuffer = source.addSourceBuffer(loader.type()))
+RUN(sourceBuffer.appendBuffer(loader.initSegment()))
+EVENT(update)
+Append a media segment.
+RUN(sourceBuffer.appendBuffer(loader.mediaSegment(0)))
+EVENT(update)
+RUN(video.playbackRate = 0.01)
+RUN(video.play())
+EVENT(playing)
+RUN(internals.beginMediaSessionInterruption('System'))
+EVENT(pause)
+RUN(internals.endMediaSessionInterruption('MayResumePlaying'))
+EVENT(playing)
+END OF TEST
+
Added: trunk/LayoutTests/media/media-source/media-source-interruption-with-resume-allowing-play.html (0 => 291118)
--- trunk/LayoutTests/media/media-source/media-source-interruption-with-resume-allowing-play.html (rev 0)
+++ trunk/LayoutTests/media/media-source/media-source-interruption-with-resume-allowing-play.html 2022-03-10 18:22:41 UTC (rev 291118)
@@ -0,0 +1,60 @@
+<html>
+ <head>
+ <script src=""
+ <script src=""
+ <script>
+ var loader;
+ var source;
+ var sourceBuffer;
+
+ function loaderPromise(loader) {
+ return new Promise((resolve, reject) => {
+ loader._onload_ = resolve;
+ loader._onerror_ = reject;
+ });
+ }
+
+ window.addEventListener('load', async event => {
+ try {
+ findMediaElement();
+ loader = new MediaSourceLoader('content/test-fragmented-manifest.json');
+ await loaderPromise(loader);
+
+ source = new MediaSource();
+ run('video.src = ""
+ await waitFor(source, 'sourceopen');
+ waitForEventAndFail('error');
+
+ run('source.duration = loader.duration()');
+ run('sourceBuffer = source.addSourceBuffer(loader.type())');
+ run('sourceBuffer.appendBuffer(loader.initSegment())');
+ await waitFor(sourceBuffer, 'update');
+
+ consoleWrite('Append a media segment.')
+ run('sourceBuffer.appendBuffer(loader.mediaSegment(0))');
+ await waitFor(sourceBuffer, 'update');
+
+ run('video.playbackRate = 0.01');
+ run('video.play()');
+ await waitFor(video, 'playing');
+
+ run("internals.beginMediaSessionInterruption('System')");
+ await waitFor(video, 'pause');
+
+ run("internals.endMediaSessionInterruption('MayResumePlaying')");
+ await waitFor(video, 'playing');
+
+ endTest();
+ } catch (e) {
+ failTest(`Caught exception: "${e}"`);
+ }
+ });
+ </script>
+</head>
+<body>
+ <div>
+ This tests that a video element sucessfully resumes playback after an interruption.
+ </div>
+ <video controls></video>
+</body>
+</html>
\ No newline at end of file
Modified: trunk/Source/WebCore/ChangeLog (291117 => 291118)
--- trunk/Source/WebCore/ChangeLog 2022-03-10 17:58:40 UTC (rev 291117)
+++ trunk/Source/WebCore/ChangeLog 2022-03-10 18:22:41 UTC (rev 291118)
@@ -1,3 +1,26 @@
+2022-03-10 Jer Noble <[email protected]>
+
+ [iOS] Netflix.com fails to resume after moving app to background during playback
+ https://bugs.webkit.org/show_bug.cgi?id=237659
+ <rdar://88775037>
+
+ Reviewed by Eric Carlson.
+
+ Test: media/media-source/media-source-interruption-with-resume-allowing-play.html
+
+ When the MediaPlayerPrivateMediaSourceAVFObjC player is asked to play or pause, it notifies
+ the client (HTMLMediaElement) that its playback state has changed. HTMLMediaElement will in response
+ call playInternal() or pauseInternal() to ensure that a state change driven by the MediaPlayer
+ is reflected up to the DOM. However, when an interruption causes the media element to suspend
+ and pause playback, this results in an additional call to pauseInternal(), which updates the
+ "state to resume" after an interruption ends to "Paused".
+
+ In mediaPlayerPlaybackStateChanged(), only call pauseInternal() or playInternal() if the reported
+ player state does not match the HTMLMediaElement's own state.
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::mediaPlayerPlaybackStateChanged):
+
2022-03-10 Sihui Liu <[email protected]>
IndexedDB: free memory used by database connection on low-memory warning
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (291117 => 291118)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2022-03-10 17:58:40 UTC (rev 291117)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2022-03-10 18:22:41 UTC (rev 291118)
@@ -5205,8 +5205,13 @@
if (!m_player || m_pausedInternal)
return;
+ updateSleepDisabling();
+
auto playerPaused = m_player->paused();
- ALWAYS_LOG(LOGIDENTIFIER, playerPaused);
+ bool shouldBePaused = !potentiallyPlaying();
+ ALWAYS_LOG(LOGIDENTIFIER, "playerPaused: ", playerPaused, ", shouldBePaused: ", shouldBePaused);
+ if (playerPaused == shouldBePaused)
+ return;
beginProcessingMediaPlayerCallback();
if (playerPaused)
@@ -5213,9 +5218,6 @@
pauseInternal();
else
playInternal();
-
- updateSleepDisabling();
-
endProcessingMediaPlayerCallback();
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes