我想知道有任何方法可以在PIP模式下恢复视频。我希望我已经在我的应用程序中创建了“画中画”模式,当我播放视频并跳转到“ PIP”模式时,它可以完美地工作,可以重新启动视频。我不想重新启动视频,就应该继续播放。有人可以帮我吗?
private void startPictureInPictureFeature() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
Rational aspectRatio = new Rational(192, 108);
pictureInPictureParamsBuilder.setAspectRatio(aspectRatio).build();
enterPictureInPictureMode(pictureInPictureParamsBuilder.build());
}
}
@Override
public void onUserLeaveHint() {
if (!isInPictureInPictureMode()) {
Rational aspectRatio = new Rational(videoView.getWidth(), videoView.getHeight());
pictureInPictureParamsBuilder.setAspectRatio(aspectRatio).build();
enterPictureInPictureMode(pictureInPictureParamsBuilder.build());
}
}