Picture in Picture interacts poorly with AirPlay/HDMI
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 18 Jul 2015 00:30:16 +0000 (00:30 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 18 Jul 2015 00:30:16 +0000 (00:30 +0000)
https://bugs.webkit.org/show_bug.cgi?id=147061
<rdar://problem/19192076>

Reviewed by Tim Horton.

When we are actively playing to an external target, the
picture in picture button should be hidden.

Also, the availability of picture in picture is also
dependent on AirPlay, so that we don't auto-pip when
we're displaying on a TV.

* Modules/mediacontrols/mediaControlsiOS.js:
(ControllerIOS.prototype.configureInlineControls): Call the update function.
(ControllerIOS.prototype.updatePictureInPictureButton): Add or remove a hidden class.
* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::allowsPictureInPicture): Check Airplay status.

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

Source/WebCore/ChangeLog
Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js
Source/WebCore/html/MediaElementSession.cpp

index 1e75921..30f37a7 100644 (file)
@@ -1,3 +1,24 @@
+2015-07-17  Dean Jackson  <dino@apple.com>
+
+        Picture in Picture interacts poorly with AirPlay/HDMI
+        https://bugs.webkit.org/show_bug.cgi?id=147061
+        <rdar://problem/19192076>
+
+        Reviewed by Tim Horton.
+
+        When we are actively playing to an external target, the
+        picture in picture button should be hidden.
+
+        Also, the availability of picture in picture is also
+        dependent on AirPlay, so that we don't auto-pip when
+        we're displaying on a TV.
+
+        * Modules/mediacontrols/mediaControlsiOS.js:
+        (ControllerIOS.prototype.configureInlineControls): Call the update function.
+        (ControllerIOS.prototype.updatePictureInPictureButton): Add or remove a hidden class.
+        * html/MediaElementSession.cpp:
+        (WebCore::MediaElementSession::allowsPictureInPicture): Check Airplay status.
+
 2015-07-17  Tim Horton  <timothy_horton@apple.com>
 
         [iOS] TextIndicator has a large forehead when line-height > 1
index 1abb2b6..dc518e0 100644 (file)
@@ -193,8 +193,7 @@ ControllerIOS.prototype = {
             // Hide the scrubber on audio until the user starts playing.
             this.controls.timelineBox.classList.add(this.ClassNames.hidden);
         } else {
-            if (Controller.gSimulatePictureInPictureAvailable || ('webkitSupportsPresentationMode' in this.video && this.video.webkitSupportsPresentationMode('picture-in-picture')))
-                this.controls.panel.appendChild(this.controls.pictureInPictureButton);
+            this.updatePictureInPictureButton();
             this.controls.panel.appendChild(this.controls.fullscreenButton);
         }
     },
@@ -573,6 +572,16 @@ ControllerIOS.prototype = {
         Controller.prototype.setShouldListenForPlaybackTargetAvailabilityEvent.call(this, shouldListen);
     },
 
+    updatePictureInPictureButton: function()
+    {
+        var shouldShowPictureInPictureButton = Controller.gSimulatePictureInPictureAvailable || ('webkitSupportsPresentationMode' in this.video && this.video.webkitSupportsPresentationMode('picture-in-picture'));
+        if (shouldShowPictureInPictureButton) {
+            this.controls.panel.appendChild(this.controls.pictureInPictureButton);
+            this.controls.pictureInPictureButton.classList.remove(this.ClassNames.hidden);
+        } else
+            this.controls.pictureInPictureButton.classList.add(this.ClassNames.hidden);
+    },
+
     handlePresentationModeChange: function(event)
     {
         var presentationMode = this.presentationMode();
index d027bc0..4a96944 100644 (file)
@@ -382,7 +382,7 @@ void MediaElementSession::mediaEngineUpdated(const HTMLMediaElement& element)
 bool MediaElementSession::allowsPictureInPicture(const HTMLMediaElement& element) const
 {
     Settings* settings = element.document().settings();
-    return settings && settings->allowsPictureInPictureMediaPlayback();
+    return settings && settings->allowsPictureInPictureMediaPlayback() && !element.webkitCurrentPlaybackTargetIsWireless();
 }
 
 #if ENABLE(MEDIA_SOURCE)