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 523265 2d12891a1a5493bac5886af3ede2db14b30a1ee6
parent 523264 6cd36394e2aeaea04ad1978e7131ac86da02f1f1
child 523266 b476772da6b0bcb6331b98cedfbdc3faae72388f
push id11121
push usernbeleuzu@mozilla.com
push dateSun, 21 Apr 2019 00:24:44 +0000
treeherdermozilla-beta@05d12183776b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersJanH, pascalc
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
--- 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");