Title: [187491] trunk/Source
Revision
187491
Author
[email protected]
Date
2015-07-28 11:20:50 -0700 (Tue, 28 Jul 2015)

Log Message

[iOS] Notify fullscreen controller in UIProcess whether external playback is allowed
https://bugs.webkit.org/show_bug.cgi?id=147343

Reviewed by Brady Eidson.

Source/WebCore:

Pass the value of the MediaElementSession's wirelessVideoPlaybackDisabled() property up through WebKit2 to
WebVideoFullscreenControllerAVKit.

* platform/ios/WebVideoFullscreenControllerAVKit.mm:
(WebVideoFullscreenControllerContext::setWirelessVideoPlaybackDisabled): Pass to the interface on the main thread.
* platform/ios/WebVideoFullscreenInterface.h:
* platform/ios/WebVideoFullscreenInterfaceAVKit.h:
* platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
(WebVideoFullscreenInterfaceAVKit::setWirelessVideoPlaybackDisabled): Sets .allowsExternalPlayback to !disabled.
(WebVideoFullscreenInterfaceAVKit::wirelessVideoPlaybackDisabled): Returns the last value set.
* platform/ios/WebVideoFullscreenModelVideoElement.mm:
(WebVideoFullscreenModelVideoElement::setWebVideoFullscreenInterface): Update the value of wirelessVideoPlaybackDisabled
    if the element is present.
(WebVideoFullscreenModelVideoElement::setVideoElement): Ditto if the interface is present.
(WebVideoFullscreenModelVideoElement::updateForEventName): Update the value either way.

Source/WebKit2:

Pass the boolean property wirelessVideoPlaybackDisabled across the UIProcess/WebProcess boundary.

* UIProcess/ios/WebVideoFullscreenManagerProxy.mm:
(WebKit::WebVideoFullscreenManagerProxy::setWirelessVideoPlaybackDisabled):
* WebProcess/ios/WebVideoFullscreenManager.mm:
(WebKit::WebVideoFullscreenInterfaceContext::setWirelessVideoPlaybackDisabled):
(WebKit::WebVideoFullscreenManager::WebVideoFullscreenManager):
(WebKit::WebVideoFullscreenManager::setWirelessVideoPlaybackDisabled):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (187490 => 187491)


--- trunk/Source/WebCore/ChangeLog	2015-07-28 18:11:59 UTC (rev 187490)
+++ trunk/Source/WebCore/ChangeLog	2015-07-28 18:20:50 UTC (rev 187491)
@@ -1,3 +1,26 @@
+2015-07-28  Jer Noble  <[email protected]>
+
+        [iOS] Notify fullscreen controller in UIProcess whether external playback is allowed
+        https://bugs.webkit.org/show_bug.cgi?id=147343
+
+        Reviewed by Brady Eidson.
+
+        Pass the value of the MediaElementSession's wirelessVideoPlaybackDisabled() property up through WebKit2 to
+        WebVideoFullscreenControllerAVKit.
+
+        * platform/ios/WebVideoFullscreenControllerAVKit.mm:
+        (WebVideoFullscreenControllerContext::setWirelessVideoPlaybackDisabled): Pass to the interface on the main thread.
+        * platform/ios/WebVideoFullscreenInterface.h:
+        * platform/ios/WebVideoFullscreenInterfaceAVKit.h:
+        * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
+        (WebVideoFullscreenInterfaceAVKit::setWirelessVideoPlaybackDisabled): Sets .allowsExternalPlayback to !disabled.
+        (WebVideoFullscreenInterfaceAVKit::wirelessVideoPlaybackDisabled): Returns the last value set.
+        * platform/ios/WebVideoFullscreenModelVideoElement.mm:
+        (WebVideoFullscreenModelVideoElement::setWebVideoFullscreenInterface): Update the value of wirelessVideoPlaybackDisabled
+            if the element is present.
+        (WebVideoFullscreenModelVideoElement::setVideoElement): Ditto if the interface is present.
+        (WebVideoFullscreenModelVideoElement::updateForEventName): Update the value either way.
+
 2015-07-28  Brady Eidson  <[email protected]>
 
         Handle null CFArrayRef returning from _CFHTTPParsedCookiesWithResponseHeaderFields.

Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm (187490 => 187491)


--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm	2015-07-28 18:11:59 UTC (rev 187490)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm	2015-07-28 18:20:50 UTC (rev 187491)
@@ -130,7 +130,8 @@
     virtual void setAudioMediaSelectionOptions(const Vector<String>& options, uint64_t selectedIndex) override;
     virtual void setLegibleMediaSelectionOptions(const Vector<String>& options, uint64_t selectedIndex) override;
     virtual void setExternalPlayback(bool enabled, ExternalPlaybackTargetType, String localizedDeviceName) override;
-    
+    virtual void setWirelessVideoPlaybackDisabled(bool) override;
+
     // WebVideoFullscreenModel
     virtual void play() override;
     virtual void pause() override;
@@ -348,6 +349,16 @@
     });
 }
 
+void WebVideoFullscreenControllerContext::setWirelessVideoPlaybackDisabled(bool disabled)
+{
+    ASSERT(WebThreadIsCurrent());
+    RefPtr<WebVideoFullscreenControllerContext> strongThis(this);
+    dispatch_async(dispatch_get_main_queue(), [strongThis, this, disabled] {
+        if (m_interface)
+            m_interface->setWirelessVideoPlaybackDisabled(disabled);
+    });
+}
+
 #pragma mark WebVideoFullscreenModel
 
 void WebVideoFullscreenControllerContext::play()

Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterface.h (187490 => 187491)


--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterface.h	2015-07-28 18:11:59 UTC (rev 187490)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterface.h	2015-07-28 18:20:50 UTC (rev 187491)
@@ -55,6 +55,7 @@
     virtual void setAudioMediaSelectionOptions(const Vector<WTF::String>& options, uint64_t selectedIndex) = 0;
     virtual void setLegibleMediaSelectionOptions(const Vector<WTF::String>& options, uint64_t selectedIndex) = 0;
     virtual void setExternalPlayback(bool enabled, ExternalPlaybackTargetType, WTF::String localizedDeviceName) = 0;
+    virtual void setWirelessVideoPlaybackDisabled(bool) = 0;
 };
 
 }

Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h (187490 => 187491)


--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h	2015-07-28 18:11:59 UTC (rev 187490)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h	2015-07-28 18:20:50 UTC (rev 187491)
@@ -90,7 +90,8 @@
     WEBCORE_EXPORT virtual void setAudioMediaSelectionOptions(const Vector<WTF::String>& options, uint64_t selectedIndex) override;
     WEBCORE_EXPORT virtual void setLegibleMediaSelectionOptions(const Vector<WTF::String>& options, uint64_t selectedIndex) override;
     WEBCORE_EXPORT virtual void setExternalPlayback(bool enabled, ExternalPlaybackTargetType, WTF::String localizedDeviceName) override;
-    
+    WEBCORE_EXPORT virtual void setWirelessVideoPlaybackDisabled(bool) override;
+
     WEBCORE_EXPORT virtual void setupFullscreen(UIView&, const IntRect& initialRect, UIView *, HTMLMediaElementEnums::VideoFullscreenMode, bool allowsPictureInPicturePlayback);
     WEBCORE_EXPORT virtual void enterFullscreen();
     WEBCORE_EXPORT virtual void exitFullscreen(const IntRect& finalRect);
@@ -112,6 +113,7 @@
     bool allowsPictureInPicturePlayback() const { return m_allowsPictureInPicturePlayback; }
     WEBCORE_EXPORT bool mayAutomaticallyShowVideoPictureInPicture() const;
     void fullscreenMayReturnToInline(std::function<void(bool)> callback);
+    bool wirelessVideoPlaybackDisabled() const;
 
     void willStartPictureInPicture();
     void didStartPictureInPicture();
@@ -148,6 +150,7 @@
     bool m_exitRequested { false };
     bool m_exitCompleted { false };
     bool m_enterRequested { false };
+    bool m_wirelessVideoPlaybackDisabled { true };
 
     void doEnterFullscreen();
 };

Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm (187490 => 187491)


--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm	2015-07-28 18:11:59 UTC (rev 187490)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm	2015-07-28 18:20:50 UTC (rev 187491)
@@ -126,6 +126,7 @@
 @property (getter=isExternalPlaybackActive) BOOL externalPlaybackActive;
 @property AVPlayerControllerExternalPlaybackType externalPlaybackType;
 @property (retain) NSString *externalPlaybackAirPlayDeviceLocalizedName;
+@property BOOL allowsExternalPlayback;
 
 - (BOOL)playerViewController:(AVPlayerViewController *)playerViewController shouldExitFullScreenWithReason:(AVPlayerViewControllerExitFullScreenReason)reason;
 @end
@@ -1018,6 +1019,16 @@
     [m_playerLayerView setHidden:enabled];
 }
 
+void WebVideoFullscreenInterfaceAVKit::setWirelessVideoPlaybackDisabled(bool disabled)
+{
+    [m_playerController setAllowsExternalPlayback:!disabled];
+}
+
+bool WebVideoFullscreenInterfaceAVKit::wirelessVideoPlaybackDisabled() const
+{
+    return [m_playerController allowsExternalPlayback];
+}
+
 @interface UIWindow ()
 - (BOOL)_isHostedInAnotherProcess;
 @end

Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelVideoElement.mm (187490 => 187491)


--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelVideoElement.mm	2015-07-28 18:11:59 UTC (rev 187490)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelVideoElement.mm	2015-07-28 18:20:50 UTC (rev 187491)
@@ -69,8 +69,10 @@
 
     if (m_videoFullscreenInterface) {
         m_videoFullscreenInterface->resetMediaState();
-        if (m_videoElement)
+        if (m_videoElement) {
             m_videoFullscreenInterface->setVideoDimensions(true, m_videoElement->videoWidth(), m_videoElement->videoHeight());
+            m_videoFullscreenInterface->setWirelessVideoPlaybackDisabled(m_videoElement->mediaSession().wirelessVideoPlaybackDisabled(*m_videoElement));
+        }
     }
 }
 
@@ -102,8 +104,10 @@
 
     updateForEventName(eventNameAll());
 
-    if (m_videoFullscreenInterface)
+    if (m_videoFullscreenInterface) {
         m_videoFullscreenInterface->setVideoDimensions(true, videoElement->videoWidth(), videoElement->videoHeight());
+        m_videoFullscreenInterface->setWirelessVideoPlaybackDisabled(m_videoElement->mediaSession().wirelessVideoPlaybackDisabled(*m_videoElement));
+    }
 }
 
 void WebVideoFullscreenModelVideoElement::handleEvent(WebCore::ScriptExecutionContext*, WebCore::Event* event)
@@ -164,6 +168,7 @@
             localizedDeviceName = m_videoElement->mediaControlsHost()->externalDeviceDisplayName();
         }
         m_videoFullscreenInterface->setExternalPlayback(enabled, targetType, localizedDeviceName);
+        m_videoFullscreenInterface->setWirelessVideoPlaybackDisabled(m_videoElement->mediaSession().wirelessVideoPlaybackDisabled(*m_videoElement));
     }
 }
 

Modified: trunk/Source/WebKit2/ChangeLog (187490 => 187491)


--- trunk/Source/WebKit2/ChangeLog	2015-07-28 18:11:59 UTC (rev 187490)
+++ trunk/Source/WebKit2/ChangeLog	2015-07-28 18:20:50 UTC (rev 187491)
@@ -1,3 +1,19 @@
+2015-07-28  Jer Noble  <[email protected]>
+
+        [iOS] Notify fullscreen controller in UIProcess whether external playback is allowed
+        https://bugs.webkit.org/show_bug.cgi?id=147343
+
+        Reviewed by Brady Eidson.
+
+        Pass the boolean property wirelessVideoPlaybackDisabled across the UIProcess/WebProcess boundary.
+
+        * UIProcess/ios/WebVideoFullscreenManagerProxy.mm:
+        (WebKit::WebVideoFullscreenManagerProxy::setWirelessVideoPlaybackDisabled):
+        * WebProcess/ios/WebVideoFullscreenManager.mm:
+        (WebKit::WebVideoFullscreenInterfaceContext::setWirelessVideoPlaybackDisabled):
+        (WebKit::WebVideoFullscreenManager::WebVideoFullscreenManager):
+        (WebKit::WebVideoFullscreenManager::setWirelessVideoPlaybackDisabled):
+
 2015-07-28  Carlos Garcia Campos  <[email protected]>
 
         [GTK] Use fastMalloc instead of g_slice

Modified: trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.h (187490 => 187491)


--- trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.h	2015-07-28 18:11:59 UTC (rev 187490)
+++ trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.h	2015-07-28 18:20:50 UTC (rev 187491)
@@ -127,6 +127,7 @@
     void setAudioMediaSelectionOptions(uint64_t contextId, Vector<String> options, uint64_t selectedIndex);
     void setLegibleMediaSelectionOptions(uint64_t contextId, Vector<String> options, uint64_t selectedIndex);
     void setExternalPlaybackProperties(uint64_t contextId, bool enabled, uint32_t targetType, String localizedDeviceName);
+    void setWirelessVideoPlaybackDisabled(uint64_t contextId, bool);
     void setDuration(uint64_t contextId, double duration);
     void setRate(uint64_t contextId, bool isPlaying, double rate);
     void enterFullscreen(uint64_t contextId);

Modified: trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in (187490 => 187491)


--- trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in	2015-07-28 18:11:59 UTC (rev 187490)
+++ trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in	2015-07-28 18:20:50 UTC (rev 187491)
@@ -31,6 +31,7 @@
     SetAudioMediaSelectionOptions(uint64_t contextId, Vector<String> options, uint64_t selectedIndex)
     SetLegibleMediaSelectionOptions(uint64_t contextId, Vector<String> options, uint64_t selectedIndex)
     SetExternalPlaybackProperties(uint64_t contextId, bool enabled, uint32_t targetType, String localizedDeviceName)
+    SetWirelessVideoPlaybackDisabled(uint64_t contextId, bool disabled)
     SetDuration(uint64_t contextId, double duration)
     SetRate(uint64_t contextId, bool isPlaying, double rate)
     SetupFullscreenWithID(uint64_t contextId, uint32_t videoLayerID, WebCore::IntRect initialRect, float hostingScaleFactor, WebCore::HTMLMediaElementEnums::VideoFullscreenMode videoFullscreenMode, bool allowsPictureInPicture)

Modified: trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm (187490 => 187491)


--- trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm	2015-07-28 18:11:59 UTC (rev 187490)
+++ trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm	2015-07-28 18:20:50 UTC (rev 187491)
@@ -393,6 +393,11 @@
     ensureInterface(contextId).setExternalPlayback(enabled, type, localizedDeviceName);
 }
 
+void WebVideoFullscreenManagerProxy::setWirelessVideoPlaybackDisabled(uint64_t contextId, bool disabled)
+{
+    ensureInterface(contextId).setWirelessVideoPlaybackDisabled(disabled);
+}
+
 void WebVideoFullscreenManagerProxy::setDuration(uint64_t contextId, double duration)
 {
     ensureInterface(contextId).setDuration(duration);

Modified: trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.h (187490 => 187491)


--- trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.h	2015-07-28 18:11:59 UTC (rev 187490)
+++ trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.h	2015-07-28 18:20:50 UTC (rev 187491)
@@ -92,6 +92,7 @@
     virtual void setAudioMediaSelectionOptions(const Vector<WTF::String>& options, uint64_t selectedIndex) override;
     virtual void setLegibleMediaSelectionOptions(const Vector<WTF::String>& options, uint64_t selectedIndex) override;
     virtual void setExternalPlayback(bool enabled, ExternalPlaybackTargetType, WTF::String localizedDeviceName) override;
+    virtual void setWirelessVideoPlaybackDisabled(bool) override;
 
     WebVideoFullscreenInterfaceContext(WebVideoFullscreenManager&, uint64_t contextId);
 
@@ -139,6 +140,7 @@
     void setAudioMediaSelectionOptions(uint64_t contextId, const Vector<String>& options, uint64_t selectedIndex);
     void setLegibleMediaSelectionOptions(uint64_t contextId, const Vector<String>& options, uint64_t selectedIndex);
     void setExternalPlayback(uint64_t contextId, bool enabled, WebCore::WebVideoFullscreenInterface::ExternalPlaybackTargetType, String localizedDeviceName);
+    void setWirelessVideoPlaybackDisabled(uint64_t contextId, bool);
 
     // Messages from WebVideoFullscreenManagerProxy
     void play(uint64_t contextId);

Modified: trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm (187490 => 187491)


--- trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm	2015-07-28 18:11:59 UTC (rev 187490)
+++ trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm	2015-07-28 18:20:50 UTC (rev 187491)
@@ -149,6 +149,12 @@
         m_manager->setExternalPlayback(m_contextId, enabled, type, localizedDeviceName);
 }
 
+void WebVideoFullscreenInterfaceContext::setWirelessVideoPlaybackDisabled(bool disabled)
+{
+    if (m_manager)
+        m_manager->setWirelessVideoPlaybackDisabled(m_contextId, disabled);
+}
+
 #pragma mark - WebVideoFullscreenManager
 
 Ref<WebVideoFullscreenManager> WebVideoFullscreenManager::create(PassRefPtr<WebPage> page)
@@ -331,6 +337,11 @@
     m_page->send(Messages::WebVideoFullscreenManagerProxy::SetExternalPlaybackProperties(contextId, enabled, static_cast<uint32_t>(targetType), localizedDeviceName), m_page->pageID());
 }
 
+void WebVideoFullscreenManager::setWirelessVideoPlaybackDisabled(uint64_t contextId, bool disabled)
+{
+    m_page->send(Messages::WebVideoFullscreenManagerProxy::SetWirelessVideoPlaybackDisabled(contextId, disabled));
+}
+
 #pragma mark Messages from WebVideoFullscreenManagerProxy:
 
 void WebVideoFullscreenManager::play(uint64_t contextId)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to