Android picture in picture appears over the black square

522 views Asked by At

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

There are 1 answers

3
Simran Chhabra On

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