Commit dbfc9a4e authored by Geoffrey Métais's avatar Geoffrey Métais

Video player: set PiP when Activity is started

parent a4db0c9d
......@@ -485,7 +485,8 @@ public class VideoPlayerActivity extends AppCompatActivity implements IPlaybackS
@TargetApi(Build.VERSION_CODES.O)
public void switchToPopup() {
final MediaWrapper mw = mService != null ? mService.getCurrentMediaWrapper() : null;
if (mw == null || !AndroidDevices.pipAllowed) return;
if (mw == null || !AndroidDevices.pipAllowed
|| !getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED)) return;
if (AndroidDevices.hasPiP) {
if (AndroidUtil.isOOrLater) try {
final SurfaceView videoSurface = (SurfaceView) (mVideoLayout != null ? mVideoLayout.findViewById(R.id.surface_video) : null);
......@@ -495,8 +496,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IPlaybackS
} catch (IllegalArgumentException e) { // Fallback with default parameters
//noinspection deprecation
enterPictureInPictureMode();
}
else {
} else {
//noinspection deprecation
enterPictureInPictureMode();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment