Title: [292666] branches/safari-613-branch
- Revision
- 292666
- Author
- [email protected]
- Date
- 2022-04-08 17:14:40 -0700 (Fri, 08 Apr 2022)
Log Message
Cherry-pick r291118. rdar://problem/91446071
[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.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@291118 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Added Paths
Diff
Modified: branches/safari-613-branch/LayoutTests/ChangeLog (292665 => 292666)
--- branches/safari-613-branch/LayoutTests/ChangeLog 2022-04-09 00:14:36 UTC (rev 292665)
+++ branches/safari-613-branch/LayoutTests/ChangeLog 2022-04-09 00:14:40 UTC (rev 292666)
@@ -1,5 +1,51 @@
2022-04-07 Alan Coon <[email protected]>
+ Cherry-pick r291118. rdar://problem/91446071
+
+ [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.
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@291118 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 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-04-07 Alan Coon <[email protected]>
+
Cherry-pick r288622. rdar://problem/91446028
[WebAuthn] Add authenticator attachment used during authentication to credential payload
Added: branches/safari-613-branch/LayoutTests/media/media-source/media-source-interruption-with-resume-allowing-play-expected.txt (0 => 292666)
--- branches/safari-613-branch/LayoutTests/media/media-source/media-source-interruption-with-resume-allowing-play-expected.txt (rev 0)
+++ branches/safari-613-branch/LayoutTests/media/media-source/media-source-interruption-with-resume-allowing-play-expected.txt 2022-04-09 00:14:40 UTC (rev 292666)
@@ -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: branches/safari-613-branch/LayoutTests/media/media-source/media-source-interruption-with-resume-allowing-play.html (0 => 292666)
--- branches/safari-613-branch/LayoutTests/media/media-source/media-source-interruption-with-resume-allowing-play.html (rev 0)
+++ branches/safari-613-branch/LayoutTests/media/media-source/media-source-interruption-with-resume-allowing-play.html 2022-04-09 00:14:40 UTC (rev 292666)
@@ -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: branches/safari-613-branch/Source/WebCore/ChangeLog (292665 => 292666)
--- branches/safari-613-branch/Source/WebCore/ChangeLog 2022-04-09 00:14:36 UTC (rev 292665)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog 2022-04-09 00:14:40 UTC (rev 292666)
@@ -1,5 +1,63 @@
2022-04-07 Alan Coon <[email protected]>
+ Cherry-pick r291118. rdar://problem/91446071
+
+ [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.
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@291118 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 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-04-07 Alan Coon <[email protected]>
+
Cherry-pick r288622. rdar://problem/91446028
[WebAuthn] Add authenticator attachment used during authentication to credential payload
Modified: branches/safari-613-branch/Source/WebCore/html/HTMLMediaElement.cpp (292665 => 292666)
--- branches/safari-613-branch/Source/WebCore/html/HTMLMediaElement.cpp 2022-04-09 00:14:36 UTC (rev 292665)
+++ branches/safari-613-branch/Source/WebCore/html/HTMLMediaElement.cpp 2022-04-09 00:14:40 UTC (rev 292666)
@@ -5189,8 +5189,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)
@@ -5197,9 +5202,6 @@
pauseInternal();
else
playInternal();
-
- updateSleepDisabling();
-
endProcessingMediaPlayerCallback();
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes