Diff
Modified: branches/safari-606-branch/Source/WebCore/ChangeLog (236218 => 236219)
--- branches/safari-606-branch/Source/WebCore/ChangeLog 2018-09-19 20:54:04 UTC (rev 236218)
+++ branches/safari-606-branch/Source/WebCore/ChangeLog 2018-09-19 20:54:11 UTC (rev 236219)
@@ -1,5 +1,117 @@
2018-09-19 Kocsen Chung <[email protected]>
+ Cherry-pick r235752. rdar://problem/44576797
+
+ Don't pause playback when locking screen if video is being displayed on second screen.
+ https://bugs.webkit.org/show_bug.cgi?id=189321
+
+ Reviewed by Eric Carlson.
+
+ Source/WebCore:
+
+ Expand the existing behavior when AirPlaying to an external device to playing to a local
+ external screen. Don't pause when the screen locks, and don't stop buffering in that mode either.
+
+ Add a KVO-observer to the WebAVPlayerController's playingOnSecondScreen property, and pass
+ that observed value on to the media element.
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::setShouldPlayToPlaybackTarget):
+ (WebCore::HTMLMediaElement::setPlayingOnSecondScreen):
+ (WebCore::HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction const):
+ (WebCore::HTMLMediaElement::processingUserGestureForMedia const):
+ (WebCore::HTMLMediaElement::mediaState const):
+ (WebCore::HTMLMediaElement::purgeBufferedDataIfPossible):
+ (WebCore::HTMLMediaElement::shouldOverrideBackgroundLoadingRestriction const):
+ (WebCore::HTMLMediaElement::webkitCurrentPlaybackTargetIsWireless const): Deleted.
+ (WebCore::HTMLMediaElement::canPlayToWirelessPlaybackTarget const): Deleted.
+ (WebCore::HTMLMediaElement::isPlayingToWirelessPlaybackTarget const): Deleted.
+ * html/HTMLMediaElement.h:
+ (WebCore::HTMLMediaElement::webkitCurrentPlaybackTargetIsWireless const):
+ (WebCore::HTMLMediaElement::isPlayingToExternalTarget const):
+ * html/MediaElementSession.cpp:
+ (WebCore::MediaElementSession::canPlayToWirelessPlaybackTarget const): Deleted.
+ * html/MediaElementSession.h:
+ * platform/audio/PlatformMediaSession.h:
+ (WebCore::PlatformMediaSessionClient::setWirelessPlaybackTarget):
+ (WebCore::PlatformMediaSessionClient::isPlayingOnSecondScreen const):
+ (WebCore::PlatformMediaSession::canPlayToWirelessPlaybackTarget const): Deleted.
+ (WebCore::PlatformMediaSessionClient::canPlayToWirelessPlaybackTarget const): Deleted.
+ * platform/cocoa/PlaybackSessionModel.h:
+ * platform/cocoa/PlaybackSessionModelMediaElement.h:
+ * platform/cocoa/PlaybackSessionModelMediaElement.mm:
+ (WebCore::PlaybackSessionModelMediaElement::setPlayingOnSecondScreen):
+ * platform/ios/WebAVPlayerController.mm:
+ (-[WebAVPlayerController init]):
+ (-[WebAVPlayerController dealloc]):
+ (-[WebAVPlayerController observeValueForKeyPath:ofObject:change:context:]):
+ * platform/ios/WebVideoFullscreenControllerAVKit.mm:
+ (VideoFullscreenControllerContext::setPlayingOnSecondScreen):
+
+ Source/WebKit:
+
+ Pass the "isPlayingOnSecondScreen" value across the process boundary.
+
+ * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
+ * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
+ (WebKit::PlaybackSessionModelContext::setPlayingOnSecondScreen):
+ (WebKit::PlaybackSessionManagerProxy::setPlayingOnSecondScreen):
+ * WebProcess/cocoa/PlaybackSessionManager.h:
+ * WebProcess/cocoa/PlaybackSessionManager.messages.in:
+ * WebProcess/cocoa/PlaybackSessionManager.mm:
+ (WebKit::PlaybackSessionManager::setPlayingOnSecondScreen):
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235752 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2018-09-06 Jer Noble <[email protected]>
+
+ Don't pause playback when locking screen if video is being displayed on second screen.
+ https://bugs.webkit.org/show_bug.cgi?id=189321
+
+ Reviewed by Eric Carlson.
+
+ Expand the existing behavior when AirPlaying to an external device to playing to a local
+ external screen. Don't pause when the screen locks, and don't stop buffering in that mode either.
+
+ Add a KVO-observer to the WebAVPlayerController's playingOnSecondScreen property, and pass
+ that observed value on to the media element.
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::setShouldPlayToPlaybackTarget):
+ (WebCore::HTMLMediaElement::setPlayingOnSecondScreen):
+ (WebCore::HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction const):
+ (WebCore::HTMLMediaElement::processingUserGestureForMedia const):
+ (WebCore::HTMLMediaElement::mediaState const):
+ (WebCore::HTMLMediaElement::purgeBufferedDataIfPossible):
+ (WebCore::HTMLMediaElement::shouldOverrideBackgroundLoadingRestriction const):
+ (WebCore::HTMLMediaElement::webkitCurrentPlaybackTargetIsWireless const): Deleted.
+ (WebCore::HTMLMediaElement::canPlayToWirelessPlaybackTarget const): Deleted.
+ (WebCore::HTMLMediaElement::isPlayingToWirelessPlaybackTarget const): Deleted.
+ * html/HTMLMediaElement.h:
+ (WebCore::HTMLMediaElement::webkitCurrentPlaybackTargetIsWireless const):
+ (WebCore::HTMLMediaElement::isPlayingToExternalTarget const):
+ * html/MediaElementSession.cpp:
+ (WebCore::MediaElementSession::canPlayToWirelessPlaybackTarget const): Deleted.
+ * html/MediaElementSession.h:
+ * platform/audio/PlatformMediaSession.h:
+ (WebCore::PlatformMediaSessionClient::setWirelessPlaybackTarget):
+ (WebCore::PlatformMediaSessionClient::isPlayingOnSecondScreen const):
+ (WebCore::PlatformMediaSession::canPlayToWirelessPlaybackTarget const): Deleted.
+ (WebCore::PlatformMediaSessionClient::canPlayToWirelessPlaybackTarget const): Deleted.
+ * platform/cocoa/PlaybackSessionModel.h:
+ * platform/cocoa/PlaybackSessionModelMediaElement.h:
+ * platform/cocoa/PlaybackSessionModelMediaElement.mm:
+ (WebCore::PlaybackSessionModelMediaElement::setPlayingOnSecondScreen):
+ * platform/ios/WebAVPlayerController.mm:
+ (-[WebAVPlayerController init]):
+ (-[WebAVPlayerController dealloc]):
+ (-[WebAVPlayerController observeValueForKeyPath:ofObject:change:context:]):
+ * platform/ios/WebVideoFullscreenControllerAVKit.mm:
+ (VideoFullscreenControllerContext::setPlayingOnSecondScreen):
+
+2018-09-19 Kocsen Chung <[email protected]>
+
Cherry-pick r235956. rdar://problem/44576825
imported/w3c/web-platform-tests/shadow-dom/form-control-form-attribute.html hits assertion
Modified: branches/safari-606-branch/Source/WebCore/html/HTMLMediaElement.cpp (236218 => 236219)
--- branches/safari-606-branch/Source/WebCore/html/HTMLMediaElement.cpp 2018-09-19 20:54:04 UTC (rev 236218)
+++ branches/safari-606-branch/Source/WebCore/html/HTMLMediaElement.cpp 2018-09-19 20:54:11 UTC (rev 236219)
@@ -5727,11 +5727,6 @@
m_mediaSession->showPlaybackTargetPicker();
}
-bool HTMLMediaElement::webkitCurrentPlaybackTargetIsWireless() const
-{
- return m_isPlayingToWirelessTarget;
-}
-
void HTMLMediaElement::wirelessRoutesAvailableDidChange()
{
enqueuePlaybackTargetAvailabilityChangedEvent();
@@ -5819,20 +5814,6 @@
m_player->setWirelessPlaybackTarget(WTFMove(device));
}
-bool HTMLMediaElement::canPlayToWirelessPlaybackTarget() const
-{
- bool canPlay = m_player && m_player->canPlayToWirelessPlaybackTarget();
-
- INFO_LOG(LOGIDENTIFIER, "returning ", canPlay);
-
- return canPlay;
-}
-
-bool HTMLMediaElement::isPlayingToWirelessPlaybackTarget() const
-{
- return m_isPlayingToWirelessTarget;
-}
-
void HTMLMediaElement::setShouldPlayToPlaybackTarget(bool shouldPlay)
{
INFO_LOG(LOGIDENTIFIER, "shouldPlay = ", shouldPlay);
@@ -5840,15 +5821,21 @@
if (m_player)
m_player->setShouldPlayToPlaybackTarget(shouldPlay);
}
-#else // ENABLE(WIRELESS_PLAYBACK_TARGET)
-bool HTMLMediaElement::webkitCurrentPlaybackTargetIsWireless() const
+#endif // ENABLE(WIRELESS_PLAYBACK_TARGET)
+
+void HTMLMediaElement::setPlayingOnSecondScreen(bool value)
{
- return false;
+ if (value == m_playingOnSecondScreen)
+ return;
+
+ m_playingOnSecondScreen = value;
+
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+ updateMediaState(UpdateState::Asynchronously);
+#endif
}
-#endif // ENABLE(WIRELESS_PLAYBACK_TARGET)
-
double HTMLMediaElement::minFastReverseRate() const
{
return m_player ? m_player->minFastReverseRate() : 0;
@@ -7567,12 +7554,10 @@
bool HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction(PlatformMediaSession::InterruptionType type) const
{
if (type == PlatformMediaSession::EnteringBackground) {
-#if ENABLE(WIRELESS_PLAYBACK_TARGET)
- if (m_isPlayingToWirelessTarget) {
- INFO_LOG(LOGIDENTIFIER, "returning true because m_isPlayingToWirelessTarget is true");
+ if (isPlayingToExternalTarget()) {
+ INFO_LOG(LOGIDENTIFIER, "returning true because isPlayingToExternalTarget() is true");
return true;
}
-#endif
if (m_videoFullscreenMode & VideoFullscreenModePictureInPicture)
return true;
#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
@@ -7580,12 +7565,10 @@
return true;
#endif
} else if (type == PlatformMediaSession::SuspendedUnderLock) {
-#if ENABLE(WIRELESS_PLAYBACK_TARGET)
- if (m_isPlayingToWirelessTarget) {
- INFO_LOG(LOGIDENTIFIER, "returning true because m_isPlayingToWirelessTarget is true");
+ if (isPlayingToExternalTarget()) {
+ INFO_LOG(LOGIDENTIFIER, "returning true because isPlayingToExternalTarget() is true");
return true;
}
-#endif
}
return false;
}
@@ -7594,8 +7577,8 @@
{
return document().processingUserGestureForMedia();
}
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
-#if ENABLE(WIRELESS_PLAYBACK_TARGET)
void HTMLMediaElement::updateMediaState(UpdateState updateState)
{
if (updateState == UpdateState::Asynchronously) {
@@ -7623,10 +7606,10 @@
bool hasActiveVideo = isVideo() && hasVideo();
bool hasAudio = this->hasAudio();
-#if ENABLE(WIRELESS_PLAYBACK_TARGET)
- if (m_isPlayingToWirelessTarget)
+ if (isPlayingToExternalTarget())
state |= IsPlayingToExternalDevice;
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
if (m_hasPlaybackTargetAvailabilityListeners) {
state |= HasPlaybackTargetAvailabilityListener;
if (!m_mediaSession->wirelessVideoPlaybackDisabled())
@@ -7749,7 +7732,7 @@
if (!MemoryPressureHandler::singleton().isUnderMemoryPressure() && m_mediaSession->dataBufferingPermitted())
return;
- if (m_isPlayingToWirelessTarget) {
+ if (isPlayingToExternalTarget()) {
INFO_LOG(LOGIDENTIFIER, "early return because playing to wireless target");
return;
}
@@ -7928,10 +7911,8 @@
bool HTMLMediaElement::shouldOverrideBackgroundLoadingRestriction() const
{
-#if ENABLE(WIRELESS_PLAYBACK_TARGET)
- if (isPlayingToWirelessPlaybackTarget())
+ if (isPlayingToExternalTarget())
return true;
-#endif
return m_videoFullscreenMode == VideoFullscreenModePictureInPicture;
}
Modified: branches/safari-606-branch/Source/WebCore/html/HTMLMediaElement.h (236218 => 236219)
--- branches/safari-606-branch/Source/WebCore/html/HTMLMediaElement.h 2018-09-19 20:54:04 UTC (rev 236218)
+++ branches/safari-606-branch/Source/WebCore/html/HTMLMediaElement.h 2018-09-19 20:54:11 UTC (rev 236219)
@@ -399,13 +399,17 @@
bool removeEventListener(const AtomicString& eventType, EventListener&, const ListenerOptions&) override;
void wirelessRoutesAvailableDidChange() override;
- bool canPlayToWirelessPlaybackTarget() const override;
- bool isPlayingToWirelessPlaybackTarget() const override;
void setWirelessPlaybackTarget(Ref<MediaPlaybackTarget>&&) override;
void setShouldPlayToPlaybackTarget(bool) override;
#endif
- bool webkitCurrentPlaybackTargetIsWireless() const;
+ bool isPlayingToWirelessPlaybackTarget() const override { return m_isPlayingToWirelessTarget; };
+ bool webkitCurrentPlaybackTargetIsWireless() const { return m_isPlayingToWirelessTarget; }
+ void setPlayingOnSecondScreen(bool value);
+ bool isPlayingOnSecondScreen() const override { return m_playingOnSecondScreen; }
+
+ bool isPlayingToExternalTarget() const { return isPlayingToWirelessPlaybackTarget() || isPlayingOnSecondScreen(); }
+
// EventTarget function.
// Both Node (via HTMLElement) and ActiveDOMObject define this method, which
// causes an ambiguity error at compile time. This class's constructor
@@ -1165,8 +1169,10 @@
MediaProducer::MediaStateFlags m_mediaState { MediaProducer::IsNotPlaying };
bool m_hasPlaybackTargetAvailabilityListeners { false };
bool m_failedToPlayToWirelessTarget { false };
+#endif
+
bool m_isPlayingToWirelessTarget { false };
-#endif
+ bool m_playingOnSecondScreen { false };
};
String convertEnumerationToString(HTMLMediaElement::PlaybackWithoutUserGesture);
Modified: branches/safari-606-branch/Source/WebCore/html/MediaElementSession.cpp (236218 => 236219)
--- branches/safari-606-branch/Source/WebCore/html/MediaElementSession.cpp 2018-09-19 20:54:04 UTC (rev 236218)
+++ branches/safari-606-branch/Source/WebCore/html/MediaElementSession.cpp 2018-09-19 20:54:11 UTC (rev 236219)
@@ -651,16 +651,6 @@
m_targetAvailabilityChangedTimer.startOneShot(0_s);
}
-bool MediaElementSession::canPlayToWirelessPlaybackTarget() const
-{
-#if !PLATFORM(IOS)
- if (!m_playbackTarget || !m_playbackTarget->hasActiveRoute())
- return false;
-#endif
-
- return client().canPlayToWirelessPlaybackTarget();
-}
-
bool MediaElementSession::isPlayingToWirelessPlaybackTarget() const
{
#if !PLATFORM(IOS)
Modified: branches/safari-606-branch/Source/WebCore/html/MediaElementSession.h (236218 => 236219)
--- branches/safari-606-branch/Source/WebCore/html/MediaElementSession.h 2018-09-19 20:54:04 UTC (rev 236218)
+++ branches/safari-606-branch/Source/WebCore/html/MediaElementSession.h 2018-09-19 20:54:11 UTC (rev 236219)
@@ -87,7 +87,6 @@
void setHasPlaybackTargetAvailabilityListeners(bool);
- bool canPlayToWirelessPlaybackTarget() const override;
bool isPlayingToWirelessPlaybackTarget() const override;
void mediaStateDidChange(MediaProducer::MediaStateFlags);
Modified: branches/safari-606-branch/Source/WebCore/platform/audio/PlatformMediaSession.h (236218 => 236219)
--- branches/safari-606-branch/Source/WebCore/platform/audio/PlatformMediaSession.h 2018-09-19 20:54:04 UTC (rev 236218)
+++ branches/safari-606-branch/Source/WebCore/platform/audio/PlatformMediaSession.h 2018-09-19 20:54:11 UTC (rev 236219)
@@ -152,7 +152,6 @@
bool shouldOverrideBackgroundLoadingRestriction() const;
- virtual bool canPlayToWirelessPlaybackTarget() const { return false; }
virtual bool isPlayingToWirelessPlaybackTarget() const { return m_isPlayingToWirelessPlaybackTarget; }
void isPlayingToWirelessPlaybackTargetChanged(bool);
@@ -240,10 +239,11 @@
virtual void wirelessRoutesAvailableDidChange() { }
virtual void setWirelessPlaybackTarget(Ref<MediaPlaybackTarget>&&) { }
- virtual bool canPlayToWirelessPlaybackTarget() const { return false; }
virtual bool isPlayingToWirelessPlaybackTarget() const { return false; }
virtual void setShouldPlayToPlaybackTarget(bool) { }
+ virtual bool isPlayingOnSecondScreen() const { return false; }
+
virtual Document* hostingDocument() const = 0;
virtual String sourceApplicationIdentifier() const = 0;
Modified: branches/safari-606-branch/Source/WebCore/platform/cocoa/PlaybackSessionModel.h (236218 => 236219)
--- branches/safari-606-branch/Source/WebCore/platform/cocoa/PlaybackSessionModel.h 2018-09-19 20:54:04 UTC (rev 236218)
+++ branches/safari-606-branch/Source/WebCore/platform/cocoa/PlaybackSessionModel.h 2018-09-19 20:54:11 UTC (rev 236219)
@@ -59,6 +59,7 @@
virtual void toggleMuted() = 0;
virtual void setMuted(bool) = 0;
virtual void setVolume(double) = 0;
+ virtual void setPlayingOnSecondScreen(bool) = 0;
enum ExternalPlaybackTargetType { TargetTypeNone, TargetTypeAirPlay, TargetTypeTVOut };
Modified: branches/safari-606-branch/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.h (236218 => 236219)
--- branches/safari-606-branch/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.h 2018-09-19 20:54:04 UTC (rev 236218)
+++ branches/safari-606-branch/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.h 2018-09-19 20:54:11 UTC (rev 236219)
@@ -73,6 +73,7 @@
WEBCORE_EXPORT void toggleMuted() final;
WEBCORE_EXPORT void setMuted(bool) final;
WEBCORE_EXPORT void setVolume(double) final;
+ WEBCORE_EXPORT void setPlayingOnSecondScreen(bool) final;
double duration() const final;
double currentTime() const final;
Modified: branches/safari-606-branch/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.mm (236218 => 236219)
--- branches/safari-606-branch/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.mm 2018-09-19 20:54:04 UTC (rev 236218)
+++ branches/safari-606-branch/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.mm 2018-09-19 20:54:11 UTC (rev 236219)
@@ -323,6 +323,12 @@
m_mediaElement->setVolume(volume);
}
+void PlaybackSessionModelMediaElement::setPlayingOnSecondScreen(bool value)
+{
+ if (m_mediaElement)
+ m_mediaElement->setPlayingOnSecondScreen(value);
+}
+
void PlaybackSessionModelMediaElement::updateMediaSelectionOptions()
{
if (!m_mediaElement)
Modified: branches/safari-606-branch/Source/WebCore/platform/ios/WebAVPlayerController.mm (236218 => 236219)
--- branches/safari-606-branch/Source/WebCore/platform/ios/WebAVPlayerController.mm 2018-09-19 20:54:04 UTC (rev 236218)
+++ branches/safari-606-branch/Source/WebCore/platform/ios/WebAVPlayerController.mm 2018-09-19 20:54:11 UTC (rev 236219)
@@ -48,6 +48,7 @@
static void * WebAVPlayerControllerSeekableTimeRangesObserverContext = &WebAVPlayerControllerSeekableTimeRangesObserverContext;
static void * WebAVPlayerControllerHasLiveStreamingContentObserverContext = &WebAVPlayerControllerHasLiveStreamingContentObserverContext;
+static void * WebAVPlayerControllerIsPlayingOnSecondScreenObserverContext = &WebAVPlayerControllerIsPlayingOnSecondScreenObserverContext;
static double WebAVPlayerControllerLiveStreamSeekableTimeRangeDurationHysteresisDelta = 3.0; // Minimum delta of time required to change the duration of the seekable time range.
static double WebAVPlayerControllerLiveStreamMinimumTargetDuration = 1.0; // Minimum segment duration to be considered valid.
@@ -71,8 +72,8 @@
[self addObserver:self forKeyPath:@"seekableTimeRanges" options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew | NSKeyValueObservingOptionInitial) context:WebAVPlayerControllerSeekableTimeRangesObserverContext];
[self addObserver:self forKeyPath:@"hasLiveStreamingContent" options:NSKeyValueObservingOptionInitial context:WebAVPlayerControllerHasLiveStreamingContentObserverContext];
+ [self addObserver:self forKeyPath:@"playingOnSecondScreen" options:NSKeyValueObservingOptionNew context:WebAVPlayerControllerIsPlayingOnSecondScreenObserverContext];
-
return self;
}
@@ -80,6 +81,7 @@
{
[self removeObserver:self forKeyPath:@"seekableTimeRanges" context:WebAVPlayerControllerSeekableTimeRangesObserverContext];
[self removeObserver:self forKeyPath:@"hasLiveStreamingContent" context:WebAVPlayerControllerHasLiveStreamingContentObserverContext];
+ [self removeObserver:self forKeyPath:@"playingOnSecondScreen" context:WebAVPlayerControllerIsPlayingOnSecondScreenObserverContext];
[_playerControllerProxy release];
[_loadedTimeRanges release];
@@ -553,6 +555,10 @@
}
} else if (WebAVPlayerControllerHasLiveStreamingContentObserverContext == context)
[self updateMinMaxTiming];
+ else if (WebAVPlayerControllerIsPlayingOnSecondScreenObserverContext == context) {
+ if (auto* delegate = self.delegate)
+ delegate->setPlayingOnSecondScreen(_playingOnSecondScreen);
+ }
}
- (void)updateMinMaxTiming
Modified: branches/safari-606-branch/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm (236218 => 236219)
--- branches/safari-606-branch/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm 2018-09-19 20:54:04 UTC (rev 236218)
+++ branches/safari-606-branch/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm 2018-09-19 20:54:11 UTC (rev 236219)
@@ -174,6 +174,7 @@
void toggleMuted() override;
void setMuted(bool) final;
void setVolume(double) final;
+ void setPlayingOnSecondScreen(bool) final;
// PlaybackSessionModelClient
void durationChanged(double) override;
@@ -701,6 +702,15 @@
});
}
+void VideoFullscreenControllerContext::setPlayingOnSecondScreen(bool value)
+{
+ ASSERT(isUIThread());
+ WebThreadRun([protectedThis = makeRefPtr(this), this, value] {
+ if (m_playbackModel)
+ m_playbackModel->setPlayingOnSecondScreen(value);
+ });
+}
+
void VideoFullscreenControllerContext::beginScrubbing()
{
ASSERT(isUIThread());
Modified: branches/safari-606-branch/Source/WebKit/ChangeLog (236218 => 236219)
--- branches/safari-606-branch/Source/WebKit/ChangeLog 2018-09-19 20:54:04 UTC (rev 236218)
+++ branches/safari-606-branch/Source/WebKit/ChangeLog 2018-09-19 20:54:11 UTC (rev 236219)
@@ -1,5 +1,89 @@
2018-09-19 Kocsen Chung <[email protected]>
+ Cherry-pick r235752. rdar://problem/44576797
+
+ Don't pause playback when locking screen if video is being displayed on second screen.
+ https://bugs.webkit.org/show_bug.cgi?id=189321
+
+ Reviewed by Eric Carlson.
+
+ Source/WebCore:
+
+ Expand the existing behavior when AirPlaying to an external device to playing to a local
+ external screen. Don't pause when the screen locks, and don't stop buffering in that mode either.
+
+ Add a KVO-observer to the WebAVPlayerController's playingOnSecondScreen property, and pass
+ that observed value on to the media element.
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::setShouldPlayToPlaybackTarget):
+ (WebCore::HTMLMediaElement::setPlayingOnSecondScreen):
+ (WebCore::HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction const):
+ (WebCore::HTMLMediaElement::processingUserGestureForMedia const):
+ (WebCore::HTMLMediaElement::mediaState const):
+ (WebCore::HTMLMediaElement::purgeBufferedDataIfPossible):
+ (WebCore::HTMLMediaElement::shouldOverrideBackgroundLoadingRestriction const):
+ (WebCore::HTMLMediaElement::webkitCurrentPlaybackTargetIsWireless const): Deleted.
+ (WebCore::HTMLMediaElement::canPlayToWirelessPlaybackTarget const): Deleted.
+ (WebCore::HTMLMediaElement::isPlayingToWirelessPlaybackTarget const): Deleted.
+ * html/HTMLMediaElement.h:
+ (WebCore::HTMLMediaElement::webkitCurrentPlaybackTargetIsWireless const):
+ (WebCore::HTMLMediaElement::isPlayingToExternalTarget const):
+ * html/MediaElementSession.cpp:
+ (WebCore::MediaElementSession::canPlayToWirelessPlaybackTarget const): Deleted.
+ * html/MediaElementSession.h:
+ * platform/audio/PlatformMediaSession.h:
+ (WebCore::PlatformMediaSessionClient::setWirelessPlaybackTarget):
+ (WebCore::PlatformMediaSessionClient::isPlayingOnSecondScreen const):
+ (WebCore::PlatformMediaSession::canPlayToWirelessPlaybackTarget const): Deleted.
+ (WebCore::PlatformMediaSessionClient::canPlayToWirelessPlaybackTarget const): Deleted.
+ * platform/cocoa/PlaybackSessionModel.h:
+ * platform/cocoa/PlaybackSessionModelMediaElement.h:
+ * platform/cocoa/PlaybackSessionModelMediaElement.mm:
+ (WebCore::PlaybackSessionModelMediaElement::setPlayingOnSecondScreen):
+ * platform/ios/WebAVPlayerController.mm:
+ (-[WebAVPlayerController init]):
+ (-[WebAVPlayerController dealloc]):
+ (-[WebAVPlayerController observeValueForKeyPath:ofObject:change:context:]):
+ * platform/ios/WebVideoFullscreenControllerAVKit.mm:
+ (VideoFullscreenControllerContext::setPlayingOnSecondScreen):
+
+ Source/WebKit:
+
+ Pass the "isPlayingOnSecondScreen" value across the process boundary.
+
+ * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
+ * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
+ (WebKit::PlaybackSessionModelContext::setPlayingOnSecondScreen):
+ (WebKit::PlaybackSessionManagerProxy::setPlayingOnSecondScreen):
+ * WebProcess/cocoa/PlaybackSessionManager.h:
+ * WebProcess/cocoa/PlaybackSessionManager.messages.in:
+ * WebProcess/cocoa/PlaybackSessionManager.mm:
+ (WebKit::PlaybackSessionManager::setPlayingOnSecondScreen):
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235752 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2018-09-06 Jer Noble <[email protected]>
+
+ Don't pause playback when locking screen if video is being displayed on second screen.
+ https://bugs.webkit.org/show_bug.cgi?id=189321
+
+ Reviewed by Eric Carlson.
+
+ Pass the "isPlayingOnSecondScreen" value across the process boundary.
+
+ * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
+ * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
+ (WebKit::PlaybackSessionModelContext::setPlayingOnSecondScreen):
+ (WebKit::PlaybackSessionManagerProxy::setPlayingOnSecondScreen):
+ * WebProcess/cocoa/PlaybackSessionManager.h:
+ * WebProcess/cocoa/PlaybackSessionManager.messages.in:
+ * WebProcess/cocoa/PlaybackSessionManager.mm:
+ (WebKit::PlaybackSessionManager::setPlayingOnSecondScreen):
+
+2018-09-19 Kocsen Chung <[email protected]>
+
Cherry-pick r236086. rdar://problem/44576830
Swipe snapshot can get stuck if swiping is disabled while it is visible
Modified: branches/safari-606-branch/Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.h (236218 => 236219)
--- branches/safari-606-branch/Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.h 2018-09-19 20:54:04 UTC (rev 236218)
+++ branches/safari-606-branch/Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.h 2018-09-19 20:54:11 UTC (rev 236219)
@@ -113,6 +113,7 @@
void toggleMuted() final;
void setMuted(bool) final;
void setVolume(double) final;
+ void setPlayingOnSecondScreen(bool) final;
double playbackStartedTime() const final { return m_playbackStartedTime; }
double duration() const final { return m_duration; }
@@ -229,6 +230,7 @@
void toggleMuted(uint64_t contextId);
void setMuted(uint64_t contextId, bool);
void setVolume(uint64_t contextId, double);
+ void setPlayingOnSecondScreen(uint64_t contextId, bool);
WebPageProxy* m_page;
HashMap<uint64_t, ModelInterfaceTuple> m_contextMap;
Modified: branches/safari-606-branch/Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.mm (236218 => 236219)
--- branches/safari-606-branch/Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.mm 2018-09-19 20:54:04 UTC (rev 236218)
+++ branches/safari-606-branch/Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.mm 2018-09-19 20:54:11 UTC (rev 236219)
@@ -152,6 +152,12 @@
m_manager->setVolume(m_contextId, volume);
}
+void PlaybackSessionModelContext::setPlayingOnSecondScreen(bool value)
+{
+ if (m_manager)
+ m_manager->setPlayingOnSecondScreen(m_contextId, value);
+}
+
void PlaybackSessionModelContext::playbackStartedTimeChanged(double playbackStartedTime)
{
m_playbackStartedTime = playbackStartedTime;
@@ -572,6 +578,12 @@
m_page->send(Messages::PlaybackSessionManager::SetVolume(contextId, volume), m_page->pageID());
}
+void PlaybackSessionManagerProxy::setPlayingOnSecondScreen(uint64_t contextId, bool value)
+{
+ if (m_page)
+ m_page->send(Messages::PlaybackSessionManager::SetPlayingOnSecondScreen(contextId, value), m_page->pageID());
+}
+
void PlaybackSessionManagerProxy::requestControlledElementID()
{
if (m_controlsManagerContextId)
Modified: branches/safari-606-branch/Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.h (236218 => 236219)
--- branches/safari-606-branch/Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.h 2018-09-19 20:54:04 UTC (rev 236218)
+++ branches/safari-606-branch/Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.h 2018-09-19 20:54:11 UTC (rev 236219)
@@ -162,6 +162,7 @@
void toggleMuted(uint64_t contextId);
void setMuted(uint64_t contextId, bool muted);
void setVolume(uint64_t contextId, double volume);
+ void setPlayingOnSecondScreen(uint64_t contextId, bool value);
WebPage* m_page;
HashMap<WebCore::HTMLMediaElement*, uint64_t> m_mediaElements;
Modified: branches/safari-606-branch/Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.messages.in (236218 => 236219)
--- branches/safari-606-branch/Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.messages.in 2018-09-19 20:54:04 UTC (rev 236218)
+++ branches/safari-606-branch/Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.messages.in 2018-09-19 20:54:11 UTC (rev 236219)
@@ -40,5 +40,6 @@
ToggleMuted(uint64_t contextId)
SetMuted(uint64_t contextId, bool muted)
SetVolume(uint64_t contextId, double volume)
+ SetPlayingOnSecondScreen(uint64_t contextId, bool value)
}
#endif
Modified: branches/safari-606-branch/Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.mm (236218 => 236219)
--- branches/safari-606-branch/Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.mm 2018-09-19 20:54:04 UTC (rev 236218)
+++ branches/safari-606-branch/Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.mm 2018-09-19 20:54:11 UTC (rev 236219)
@@ -508,6 +508,12 @@
ensureModel(contextId).setVolume(volume);
}
+void PlaybackSessionManager::setPlayingOnSecondScreen(uint64_t contextId, bool value)
+{
+ UserGestureIndicator indicator(ProcessingUserGesture);
+ ensureModel(contextId).setPlayingOnSecondScreen(value);
+}
+
} // namespace WebKit
#endif // PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))