Title: [174872] branches/safari-600.1.4.12-branch/Source/WebCore

Diff

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


--- branches/safari-600.1.4.12-branch/Source/WebCore/ChangeLog	2014-10-19 17:40:09 UTC (rev 174871)
+++ branches/safari-600.1.4.12-branch/Source/WebCore/ChangeLog	2014-10-19 17:44:09 UTC (rev 174872)
@@ -1,5 +1,35 @@
 2014-10-19  Babak Shafiei  <[email protected]>
 
+        Merge r174651.
+
+    2014-10-13  Jer Noble  <[email protected]>
+
+            [iOS] Stop listening for wireless playback target availability when the default controls are hidden.
+            https://bugs.webkit.org/show_bug.cgi?id=137633
+
+            Reviewed by Dean Jackson.
+
+            In order to minimize the excess bandwidth and power consumption required for actively listening
+            for wireless playback target availablity, unregister for those notifications while the controls
+            are hidden due to playback, or when the element's document is hidden.
+
+            * Modules/mediacontrols/mediaControlsiOS.js:
+            (ControllerIOS.prototype.createBase): Register for document visiblity change notfications.
+            (ControllerIOS.prototype.setControlsType): Call updateShouldListenForPlaybackTargetAvailabilityEvent()
+                instead of setShouldListenForPlaybackTargetAvailabilityEvent()
+            (ControllerIOS.prototype.hideControls): Ditto.
+            (ControllerIOS.prototype.showControls): Ditto.
+            (ControllerIOS.prototype.updateStatusDisplay): Ditto.
+            (ControllerIOS.prototype.handleVisibilityChange): Ditto.
+            (ControllerIOS.prototype.updateShouldListenForPlaybackTargetAvailabilityEvent): Added. Only listen
+                for target availability when the video has no errors, is not in the initial "big play button"
+                controls state, and when the controls are not hidden.
+            * platform/audio/ios/MediaSessionManagerIOS.mm:
+            (-[WebMediaSessionHelper stopMonitoringAirPlayRoutes]): Explicitly set the discoveryMode to "disabled"
+                rather than waiting for the autoreleasepool to destroy our routing controller.
+
+2014-10-19  Babak Shafiei  <[email protected]>
+
         Merge r174073.
 
     2014-09-29  Eric Carlson  <[email protected]>

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


--- branches/safari-600.1.4.12-branch/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js	2014-10-19 17:40:09 UTC (rev 174871)
+++ branches/safari-600.1.4.12-branch/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js	2014-10-19 17:44:09 UTC (rev 174872)
@@ -54,6 +54,8 @@
         this.listenFor(this.base, 'touchstart', this.handleWrapperTouchStart);
         this.stopListeningFor(this.base, 'mousemove', this.handleWrapperMouseMove);
         this.stopListeningFor(this.base, 'mouseout', this.handleWrapperMouseOut);
+
+        this.listenFor(document, 'visibilitychange', this.handleVisibilityChange);
     },
 
     shouldHaveStartPlaybackButton: function() {
@@ -177,7 +179,7 @@
         else
             this.removeStartPlaybackControls();
 
-        this.setShouldListenForPlaybackTargetAvailabilityEvent(type !== ControllerIOS.StartPlaybackControls);
+        this.updateShouldListenForPlaybackTargetAvailabilityEvent();
     },
 
     addStartPlaybackControls: function() {
@@ -209,6 +211,16 @@
         // Do nothing
     },
 
+    hideControls: function() {
+        Controller.prototype.hideControls.call(this);
+        this.updateShouldListenForPlaybackTargetAvailabilityEvent();
+    },
+
+    showControls: function() {
+        Controller.prototype.showControls.call(this);
+        this.updateShouldListenForPlaybackTargetAvailabilityEvent();
+    },
+
     updateControls: function() {
         if (this.shouldHaveStartPlaybackButton())
             this.setControlsType(ControllerIOS.StartPlaybackControls);
@@ -347,6 +359,10 @@
         this.video.style.removeProperty('-webkit-user-select');
     },
 
+    handleVisibilityChange: function(event) {
+        this.updateShouldListenForPlaybackTargetAvailabilityEvent();
+    },
+
     isFullScreen: function()
     {
         return this.video.webkitDisplayingFullscreen;
@@ -431,10 +447,23 @@
         return true;
     },
 
+    updateShouldListenForPlaybackTargetAvailabilityEvent: function() {
+        var shouldListen = true;
+        if (this.video.error)
+            shouldListen = false;
+        if (this.controlsType === ControllerIOS.StartPlaybackControls)
+            shouldListen = false;
+        if (!this.isAudio() && !this.video.paused && this.controlsAreHidden())
+            shouldListen = false;
+        if (document.hidden)
+            shouldListen = false;
+
+        this.setShouldListenForPlaybackTargetAvailabilityEvent(shouldListen);
+    },
+
     updateStatusDisplay: function(event)
     {
-        if (this.video.error)
-            setShouldListenForPlaybackTargetAvailabilityEvent(false);
+        this.updateShouldListenForPlaybackTargetAvailabilityEvent();
         this.controls.startPlaybackButton.classList.toggle(this.ClassNames.failed, this.video.error !== null);
         Controller.prototype.updateStatusDisplay.call(this, event);
     },

Modified: branches/safari-600.1.4.12-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm (174871 => 174872)


--- branches/safari-600.1.4.12-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm	2014-10-19 17:40:09 UTC (rev 174871)
+++ branches/safari-600.1.4.12-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm	2014-10-19 17:44:09 UTC (rev 174872)
@@ -262,6 +262,10 @@
 
 - (void)stopMonitoringAirPlayRoutes
 {
+    if (!_airPlayPresenceRoutingController)
+        return;
+
+    [_airPlayPresenceRoutingController setDiscoveryMode:MPRouteDiscoveryModeDisabled];
     _airPlayPresenceRoutingController = nil;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to