1

I've got a strange problem with Android Picture-in-picture.

I manage a mobile app which uses Picture-in-picture feature with the Exoplayer and some fragments. The activity has such flags:

            android:name=".activities.main.MainActivity"
            android:configChanges="keyboardHidden|orientation|screenSize|smallestScreenSize|screenLayout"
            android:windowSoftInputMode="adjustNothing"
            android:launchMode="singleTask"
            android:resizeableActivity="true"
            android:hardwareAccelerated="true"
            android:supportsPictureInPicture="true"
            android:screenOrientation="portrait">

Also there are some fragments, two of which are using Exoplayer and one of them can enter PiP.

When I enter PiP - a black square appears behind player fragment, sometimes with the frame from the second player (but that fragment is closed by that moment). Fragment (that is shown in PiP) has the player with MATCH_PARENT layout params, without any padding or margins.

Exoplayer is 2.11.0.

PiP params builder has ratio of 16/9.

In general PiP works fine, with pause/play.

Here's what it looks like: Example image

I wonder how to get rid of this square? Any advises or suggestions would be appreciated.

1 Answers1

0

You can use enterPictureInPictureMode(); in Activity or getActivity().enterPictureInPictureMode(); inside a fragment

  • Hi! Thanks, but that is already working. I call that method in activity and it shows the picture-in-picture box. But sometimes it appears with a black square in background which I want to get rid of - that is the problem. – Yevhen Ivanets Sep 29 '20 at 12:46
  • did you find any solution??? – pavel Apr 03 '22 at 13:09