Bug 1543680 - Set playbackState as playing when entering in PiP mode. r=JanH a=pascalc
authorPetru Lingurar <petru.lingurar@softvision.ro>
Sun, 21 Apr 2019 03:11:06 +0300
changeset 526263 2d12891a1a5493bac5886af3ede2db14b30a1ee6
parent 526262 6cd36394e2aeaea04ad1978e7131ac86da02f1f1
child 526264 b476772da6b0bcb6331b98cedfbdc3faae72388f
push id2032
push userffxbld-merge
push dateMon, 13 May 2019 09:36:57 +0000
treeherdermozilla-release@455c1065dcbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersJanH, pascalc
bugs1543680
milestone67.0
Bug 1543680 - Set playbackState as playing when entering in PiP mode. r=JanH a=pascalc Summary: playbackState's default value is PlaybackState.STOPPED. We can only enter PiP mode if media is playing but we don't save this playing state. If the user hasn't done anything to change this, like pause-play, when we check the playbackState in BrowserApp to know to force fullscreen if still playing we will not do so because the state is PlaybackState.STOPPED. Reviewers: JanH Reviewed By: JanH Subscribers: jya Bug #: 1543680 Differential Revision: https://phabricator.services.mozilla.com/D27935
mobile/android/base/java/org/mozilla/gecko/media/PictureInPictureController.java
--- a/mobile/android/base/java/org/mozilla/gecko/media/PictureInPictureController.java
+++ b/mobile/android/base/java/org/mozilla/gecko/media/PictureInPictureController.java
@@ -48,16 +48,17 @@ public class PictureInPictureController 
     /**
      * If the feature is supported and media is playing in fullscreen will try to activate
      * Picture In Picture mode for the current activity.
      * @throws IllegalStateException if entering Picture In Picture mode was not possible.
      */
     public void tryEnteringPictureInPictureMode() throws IllegalStateException {
         if (shouldTryPipMode() &&
                 pipActivity.enterPictureInPictureMode(getPipParams(isMediaPlayingForCurrentTab()))) {
+            playbackState = PlaybackState.PLAYING;
             EventDispatcher.getInstance().registerUiThreadListener(this, "MediaControlService:MediaPlayingStatus");
             isInPipMode = true;
         }
     }
 
     public void cleanResources() {
         if (isInPipMode) {
             EventDispatcher.getInstance().unregisterUiThreadListener(this, "MediaControlService:MediaPlayingStatus");