Bug 1357639 - part1 : change tab's media playing state when the tab is controlled by media control. r=sebastian
☠☠ backed out by 90becadc7978 ☠ ☠
authorAlastor Wu <alwu@mozilla.com>
Thu, 04 May 2017 15:19:39 +0800
changeset 356478 6fa5520670a334c592e83d19305b0b83933ba9bc
parent 356477 8f8cb62a874903f66603da14326bfc52326c30f9
child 356479 608cca1e60592b4468fcf47ce71822fc65befac8
push id31767
push usercbook@mozilla.com
push dateFri, 05 May 2017 13:15:58 +0000
treeherdermozilla-central@8872ad4d52b6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssebastian
bugs1357639
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1357639 - part1 : change tab's media playing state when the tab is controlled by media control. r=sebastian MozReview-Commit-ID: 7CNbMdCJT3K
mobile/android/base/java/org/mozilla/gecko/media/MediaControlService.java
--- a/mobile/android/base/java/org/mozilla/gecko/media/MediaControlService.java
+++ b/mobile/android/base/java/org/mozilla/gecko/media/MediaControlService.java
@@ -330,26 +330,35 @@ public class MediaControlService extends
                 setState(State.STOPPED);
                 notifyObservers("mediaControl", "mediaControlStopped");
                 mTabReference = new WeakReference<>(null);
             }
         });
 
     }
 
+    private void setMediaStateForTab(boolean isTabPlaying) {
+        final Tab tab = mTabReference.get();
+        if (tab == null) {
+            return;
+        }
+        tab.setIsMediaPlaying(isTabPlaying);
+    }
+
     private void notifyObservers(String topic, String data) {
         GeckoAppShell.notifyObservers(topic, data);
     }
 
     private boolean isNeedToRemoveControlInterface(State state) {
         return state.equals(State.STOPPED);
     }
 
     private void setState(State newState) {
         mMediaState = newState;
+        setMediaStateForTab(mMediaState.equals(State.PLAYING));
         onStateChanged();
     }
 
     private void onStateChanged() {
         if (!mInitialize) {
             return;
         }