[Extra zoom mode] Don't allow PiP media playback
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Feb 2018 22:29:38 +0000 (22:29 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Feb 2018 22:29:38 +0000 (22:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=182930
<rdar://problem/37676259>

Reviewed by Andy Estes.

Source/WebCore:

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): Don't call setPIPModeEnabled:
if it isn't implemented.
(WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenMode): Ditto.

Source/WebKit:

* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration init]): Don't enable PiP mode. Require user interaction for
all media types.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@228712 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm

index b1131af..6cc5fec 100644 (file)
@@ -1,3 +1,16 @@
+2018-02-19  Eric Carlson  <eric.carlson@apple.com>
+
+        [Extra zoom mode] Don't allow PiP media playback
+        https://bugs.webkit.org/show_bug.cgi?id=182930
+        <rdar://problem/37676259>
+
+        Reviewed by Andy Estes.
+
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): Don't call setPIPModeEnabled:
+        if it isn't implemented.
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenMode): Ditto.
+
 2018-02-19  Antoine Quint  <graouts@apple.com>
 
         [Web Animations] Decouple parsing JS keyframes and computing blending keyframes
index d992d2b..af3995b 100644 (file)
@@ -708,7 +708,8 @@ void MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer()
     m_videoFullscreenLayerManager->setVideoLayer(m_videoLayer.get(), defaultSize);
 
 #if PLATFORM(IOS)
-    [m_videoLayer setPIPModeEnabled:(player()->fullscreenMode() & MediaPlayer::VideoFullscreenModePictureInPicture)];
+    if ([m_videoLayer respondsToSelector:@selector(setPIPModeEnabled:)])
+        [m_videoLayer setPIPModeEnabled:(player()->fullscreenMode() & MediaPlayer::VideoFullscreenModePictureInPicture)];
 #endif
 #else
     [m_videoLayer setFrame:CGRectMake(0, 0, defaultSize.width(), defaultSize.height())];
@@ -1228,7 +1229,8 @@ void MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenGravity(MediaPlayer::
 void MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenMode(MediaPlayer::VideoFullscreenMode mode)
 {
 #if PLATFORM(IOS)
-    [m_videoLayer setPIPModeEnabled:(mode & MediaPlayer::VideoFullscreenModePictureInPicture)];
+    if ([m_videoLayer respondsToSelector:@selector(setPIPModeEnabled:)])
+        [m_videoLayer setPIPModeEnabled:(mode & MediaPlayer::VideoFullscreenModePictureInPicture)];
     updateDisableExternalPlayback();
 #else
     UNUSED_PARAM(mode);
index 07503b9..6770358 100644 (file)
@@ -1,3 +1,15 @@
+2018-02-19  Eric Carlson  <eric.carlson@apple.com>
+
+        [Extra zoom mode] Don't allow PiP media playback
+        https://bugs.webkit.org/show_bug.cgi?id=182930
+        <rdar://problem/37676259>
+
+        Reviewed by Andy Estes.
+
+        * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
+        (-[WKWebViewConfiguration init]): Don't enable PiP mode. Require user interaction for
+        all media types.
+
 2018-02-19  Ryan Haddad  <ryanhaddad@apple.com>
 
         Unreviewed, rolling out r228696.
index 358184a..9406897 100644 (file)
@@ -174,14 +174,18 @@ static _WKDragLiftDelay toDragLiftDelay(NSUInteger value)
     WebKit::InitializeWebKit2();
 
 #if PLATFORM(IOS)
+#if !ENABLE(EXTRA_ZOOM_MODE)
     _allowsPictureInPictureMediaPlayback = YES;
+#endif
     _allowsInlineMediaPlayback = WebCore::deviceClass() == MGDeviceClassiPad;
     _inlineMediaPlaybackRequiresPlaysInlineAttribute = !_allowsInlineMediaPlayback;
     _allowsInlineMediaPlaybackAfterFullscreen = !_allowsInlineMediaPlayback;
     _mediaDataLoadsAutomatically = NO;
+#if !ENABLE(EXTRA_ZOOM_MODE)
     if (WebKit::linkedOnOrAfter(WebKit::SDKVersion::FirstWithMediaTypesRequiringUserActionForPlayback))
         _mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeAudio;
     else
+#endif
         _mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeAll;
     _ignoresViewportScaleLimits = NO;
     _legacyEncryptedMediaAPIEnabled = NO;