Title: [174871] branches/safari-600.1.4.12-branch/Source/WebCore
Revision
174871
Author
[email protected]
Date
2014-10-19 10:40:09 -0700 (Sun, 19 Oct 2014)

Log Message

Merged r174073. <rdar://problem/18479051>

Modified Paths

Diff

Modified: branches/safari-600.1.4.12-branch/Source/WebCore/ChangeLog (174870 => 174871)


--- branches/safari-600.1.4.12-branch/Source/WebCore/ChangeLog	2014-10-19 16:50:02 UTC (rev 174870)
+++ branches/safari-600.1.4.12-branch/Source/WebCore/ChangeLog	2014-10-19 17:40:09 UTC (rev 174871)
@@ -1,3 +1,29 @@
+2014-10-19  Babak Shafiei  <[email protected]>
+
+        Merge r174073.
+
+    2014-09-29  Eric Carlson  <[email protected]>
+
+            [iOS] Optimize media controls AirPlay discovery
+            https://bugs.webkit.org/show_bug.cgi?id=137180
+
+            Reviewed by Darin Adler.
+        
+            AirPlay discovery mode uses increases power consumption, so don't enable it when there
+            is no chance an AirPlay target picker will be useful.
+
+            * Modules/mediacontrols/mediaControlsiOS.js:
+            (ControllerIOS): Initialize isListeningForPlaybackTargetAvailabilityEvent.
+            (ControllerIOS.prototype.addVideoListeners): Don't enable register wireless playback event
+                listeners, it isn't possible to show the target picker until there is an inline controller.
+            (ControllerIOS.prototype.removeVideoListeners): Call setShouldListenForPlaybackTargetAvailabilityEvent.
+            (ControllerIOS.prototype.setControlsType): Add wireless event listers on when not showing 
+                the one button controller.
+            (ControllerIOS.prototype.updateStatusDisplay): Unregister wireless event listeners when the
+                media element is in an error state.
+            (ControllerIOS.prototype.setShouldListenForPlaybackTargetAvailabilityEvent): New, add or
+                remove event listeners.
+
 2014-10-03  Babak Shafiei  <[email protected]>
 
         Merge r174277.

Modified: branches/safari-600.1.4.12-branch/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js (174870 => 174871)


--- branches/safari-600.1.4.12-branch/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js	2014-10-19 16:50:02 UTC (rev 174870)
+++ branches/safari-600.1.4.12-branch/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js	2014-10-19 17:40:09 UTC (rev 174871)
@@ -7,6 +7,7 @@
 {
     this.hasWirelessPlaybackTargets = false;
     this._pageScaleFactor = 1;
+    this.isListeningForPlaybackTargetAvailabilityEvent = false;
     Controller.call(this, root, video, host);
 
     this.updateWirelessTargetAvailable();
@@ -29,11 +30,6 @@
 
         this.listenFor(this.video, 'webkitbeginfullscreen', this.handleFullscreenChange);
         this.listenFor(this.video, 'webkitendfullscreen', this.handleFullscreenChange);
-
-        if (window.WebKitPlaybackTargetAvailabilityEvent) {
-            this.listenFor(this.video, 'webkitcurrentplaybacktargetiswirelesschanged', this.handleWirelessPlaybackChange);
-            this.listenFor(this.video, 'webkitplaybacktargetavailabilitychanged', this.handleWirelessTargetAvailableChange);
-        }
     },
 
     removeVideoListeners: function() {
@@ -42,10 +38,7 @@
         this.stopListeningFor(this.video, 'webkitbeginfullscreen', this.handleFullscreenChange);
         this.stopListeningFor(this.video, 'webkitendfullscreen', this.handleFullscreenChange);
 
-        if (window.WebKitPlaybackTargetAvailabilityEvent) {
-            this.stopListeningFor(this.video, 'webkitcurrentplaybacktargetiswirelesschanged', this.handleWirelessPlaybackChange);
-            this.stopListeningFor(this.video, 'webkitplaybacktargetavailabilitychanged', this.handleWirelessTargetAvailableChange);
-        }
+        this.setShouldListenForPlaybackTargetAvailabilityEvent(false);
     },
 
     createBase: function() {
@@ -183,6 +176,8 @@
             this.addStartPlaybackControls();
         else
             this.removeStartPlaybackControls();
+
+        this.setShouldListenForPlaybackTargetAvailabilityEvent(type !== ControllerIOS.StartPlaybackControls);
     },
 
     addStartPlaybackControls: function() {
@@ -438,6 +433,8 @@
 
     updateStatusDisplay: function(event)
     {
+        if (this.video.error)
+            setShouldListenForPlaybackTargetAvailabilityEvent(false);
         this.controls.startPlaybackButton.classList.toggle(this.ClassNames.failed, this.video.error !== null);
         Controller.prototype.updateStatusDisplay.call(this, event);
     },
@@ -448,6 +445,24 @@
         Controller.prototype.setPlaying.call(this, isPlaying);
     },
 
+    setShouldListenForPlaybackTargetAvailabilityEvent: function(shouldListen)
+    {
+        if (!window.WebKitPlaybackTargetAvailabilityEvent || this.isListeningForPlaybackTargetAvailabilityEvent == shouldListen)
+            return;
+
+        if (shouldListen && (this.shouldHaveStartPlaybackButton() || this.video.error))
+            return;
+
+        this.isListeningForPlaybackTargetAvailabilityEvent = shouldListen;
+        if (shouldListen) {
+            this.listenFor(this.video, 'webkitcurrentplaybacktargetiswirelesschanged', this.handleWirelessPlaybackChange);
+            this.listenFor(this.video, 'webkitplaybacktargetavailabilitychanged', this.handleWirelessTargetAvailableChange);
+        } else {
+            this.stopListeningFor(this.video, 'webkitcurrentplaybacktargetiswirelesschanged', this.handleWirelessPlaybackChange);
+            this.stopListeningFor(this.video, 'webkitplaybacktargetavailabilitychanged', this.handleWirelessTargetAvailableChange);
+        }
+    },
+
     get pageScaleFactor() {
         return this._pageScaleFactor;
     },
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to