Diff
Modified: trunk/LayoutTests/ChangeLog (233359 => 233360)
--- trunk/LayoutTests/ChangeLog 2018-06-29 16:54:05 UTC (rev 233359)
+++ trunk/LayoutTests/ChangeLog 2018-06-29 17:15:08 UTC (rev 233360)
@@ -1,3 +1,14 @@
+2018-06-29 Jer Noble <jer.no...@apple.com>
+
+ Returning PiP'd video to fullscreen while playing leaves video muted.
+ https://bugs.webkit.org/show_bug.cgi?id=187181
+ <rdar://problem/41408335>
+
+ Reviewed by Eric Carlson.
+
+ * media/picture-in-picture-interruption-expected.txt: Added.
+ * media/picture-in-picture-interruption.html: Added.
+
2018-06-29 Per Arne Vollan <pvol...@apple.com>
Layout Test imported/mozilla/css-animations/test_animation-starttime.html is failing.
Added: trunk/LayoutTests/media/picture-in-picture-interruption-expected.txt (0 => 233360)
--- trunk/LayoutTests/media/picture-in-picture-interruption-expected.txt (rev 0)
+++ trunk/LayoutTests/media/picture-in-picture-interruption-expected.txt 2018-06-29 17:15:08 UTC (rev 233360)
@@ -0,0 +1,14 @@
+This tests that video is in the correct media session state after ending a background interruption while pipped.
+
+RUN(internals.settings.setAllowsPictureInPictureMediaPlayback(true))
+RUN(video.src = "" "content/test"))
+EVENT(canplaythrough)
+RUN(video.play())
+EVENT(playing)
+EVENT(webkitpresentationmodechanged)
+RUN(internals.beginMediaSessionInterruption("enteringbackground"))
+EXPECTED (internals.mediaSessionState(video) == 'Playing') OK
+RUN(internals.endMediaSessionInterruption("enteringbackground"))
+EXPECTED (internals.mediaSessionState(video) == 'Playing') OK
+END OF TEST
+
Added: trunk/LayoutTests/media/picture-in-picture-interruption.html (0 => 233360)
--- trunk/LayoutTests/media/picture-in-picture-interruption.html (rev 0)
+++ trunk/LayoutTests/media/picture-in-picture-interruption.html 2018-06-29 17:15:08 UTC (rev 233360)
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <script src=""
+ <script src=""
+ <script>
+ window.addEventListener('load', async event => {
+ findMediaElement();
+
+ run('internals.settings.setAllowsPictureInPictureMediaPlayback(true)');
+
+ run('video.src = "" "content/test")');
+ await waitFor(video, 'canplaythrough');
+
+ run('video.play()');
+ await waitFor(video, 'playing');
+
+ runWithKeyDown(function(){ video.webkitSetPresentationMode('picture-in-picture'); });
+ await waitFor(video, 'webkitpresentationmodechanged');
+
+ run('internals.beginMediaSessionInterruption("enteringbackground")');
+
+ testExpected('internals.mediaSessionState(video)', 'Playing');
+
+ run('internals.endMediaSessionInterruption("enteringbackground")');
+
+ testExpected('internals.mediaSessionState(video)', 'Playing');
+
+ endTest();
+ });
+ </script>
+</head>
+<body>
+ <div>This tests that video is in the correct media session state after ending a background interruption while pipped.</div>
+ <video controls></video>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (233359 => 233360)
--- trunk/Source/WebCore/ChangeLog 2018-06-29 16:54:05 UTC (rev 233359)
+++ trunk/Source/WebCore/ChangeLog 2018-06-29 17:15:08 UTC (rev 233360)
@@ -1,3 +1,22 @@
+2018-06-29 Jer Noble <jer.no...@apple.com>
+
+ Returning PiP'd video to fullscreen while playing leaves video muted.
+ https://bugs.webkit.org/show_bug.cgi?id=187181
+ <rdar://problem/41408335>
+
+ Reviewed by Eric Carlson.
+
+ Test: media/picture-in-picture-interruption.html
+
+ Don't reset the media session's state at the end of an interruption if it wasn't changed an the beginning of one.
+
+ * platform/audio/PlatformMediaSession.cpp:
+ (WebCore::PlatformMediaSession::endInterruption):
+ * testing/Internals.cpp:
+ (WebCore::Internals::mediaSessionState):
+ * testing/Internals.h:
+ * testing/Internals.idl:
+
2018-06-29 Zalan Bujtas <za...@apple.com>
[LFC] When the formatting root is also a containing block for out-of-flow elements.
Modified: trunk/Source/WebCore/platform/audio/PlatformMediaSession.cpp (233359 => 233360)
--- trunk/Source/WebCore/platform/audio/PlatformMediaSession.cpp 2018-06-29 16:54:05 UTC (rev 233359)
+++ trunk/Source/WebCore/platform/audio/PlatformMediaSession.cpp 2018-06-29 17:15:08 UTC (rev 233360)
@@ -154,6 +154,9 @@
if (--m_interruptionCount)
return;
+ if (m_interruptionType == NoInterruption)
+ return;
+
State stateToRestore = m_stateToRestore;
m_stateToRestore = Idle;
m_interruptionType = NoInterruption;
Modified: trunk/Source/WebCore/testing/Internals.cpp (233359 => 233360)
--- trunk/Source/WebCore/testing/Internals.cpp 2018-06-29 16:54:05 UTC (rev 233359)
+++ trunk/Source/WebCore/testing/Internals.cpp 2018-06-29 17:15:08 UTC (rev 233360)
@@ -3744,6 +3744,11 @@
{
return HTMLMediaElement::bestMediaElementForShowingPlaybackControlsManager(purpose);
}
+
+Internals::MediaSessionState Internals::mediaSessionState(HTMLMediaElement& element)
+{
+ return element.mediaSession().state();
+}
#endif
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
Modified: trunk/Source/WebCore/testing/Internals.h (233359 => 233360)
--- trunk/Source/WebCore/testing/Internals.h 2018-06-29 16:54:05 UTC (rev 233359)
+++ trunk/Source/WebCore/testing/Internals.h 2018-06-29 17:15:08 UTC (rev 233360)
@@ -699,9 +699,14 @@
};
ExceptionOr<NowPlayingState> nowPlayingState() const;
+#if ENABLE(VIDEO)
using PlaybackControlsPurpose = MediaElementSession::PlaybackControlsPurpose;
HTMLMediaElement* bestMediaElementForShowingPlaybackControlsManager(PlaybackControlsPurpose);
+ using MediaSessionState = PlatformMediaSession::State;
+ MediaSessionState mediaSessionState(HTMLMediaElement&);
+#endif
+
void setCaptureExtraNetworkLoadMetricsEnabled(bool);
String ongoingLoadsDescriptions() const;
Modified: trunk/Source/WebCore/testing/Internals.idl (233359 => 233360)
--- trunk/Source/WebCore/testing/Internals.idl 2018-06-29 16:54:05 UTC (rev 233359)
+++ trunk/Source/WebCore/testing/Internals.idl 2018-06-29 17:15:08 UTC (rev 233360)
@@ -87,6 +87,14 @@
"NowPlaying"
};
+[Conditional=VIDEO] enum MediaSessionState {
+ "Idle",
+ "Autoplaying",
+ "Playing",
+ "Paused",
+ "Interrupted"
+};
+
[
ExportMacro=WEBCORE_TESTSUPPORT_EXPORT,
Conditional=VIDEO,
@@ -635,6 +643,7 @@
[Conditional=VIDEO, MayThrowException] readonly attribute NowPlayingState nowPlayingState;
[Conditional=VIDEO] HTMLMediaElement bestMediaElementForShowingPlaybackControlsManager(PlaybackControlsPurpose purpose);
+ [Conditional=VIDEO] MediaSessionState mediaSessionState(HTMLMediaElement element);
DOMString ongoingLoadsDescriptions();
void setCaptureExtraNetworkLoadMetricsEnabled(boolean value);