Skip to content

Commit

Permalink
mod 画中画部分代码 SDK 版本校验修正
Browse files Browse the repository at this point in the history
  • Loading branch information
KLOSWC committed Mar 7, 2024
1 parent ebb3126 commit dec7062
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1125,20 +1125,20 @@ public void onUserLeaveHint() {
} else {
ratio = new Rational(16, 9);
}
//此处需要大于23 版本才能执行
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O) {
List<android.app.RemoteAction> actions = new ArrayList<>();
List<android.app.RemoteAction> actions = new ArrayList<>();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
actions.add(generateRemoteAction(android.R.drawable.ic_media_previous, BROADCAST_ACTION_PREV, "Prev", "Play Previous"));
actions.add(generateRemoteAction(android.R.drawable.ic_media_play, BROADCAST_ACTION_PLAYPAUSE, "Play", "Play/Pause"));
actions.add(generateRemoteAction(android.R.drawable.ic_media_next, BROADCAST_ACTION_NEXT, "Next", "Play Next"));
PictureInPictureParams params = new PictureInPictureParams.Builder()
.setAspectRatio(ratio)
.setActions(actions).build();
enterPictureInPictureMode(params);
}
PictureInPictureParams params = new PictureInPictureParams.Builder()
.setAspectRatio(ratio)
.setActions(actions).build();
if (!fullWindows) {
toggleFullPreview();
}
enterPictureInPictureMode(params);

playFragment.getVodController().hideBottom();
playFragment.getPlayer().postDelayed(() -> {
if (!playFragment.getPlayer().isPlaying()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1142,16 +1142,18 @@ public void onUserLeaveHint() {
} else {
ratio = new Rational(16, 9);
}
if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.O) {
List<android.app.RemoteAction> actions = new ArrayList<>();

List<android.app.RemoteAction> actions = new ArrayList<>();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
actions.add(generateRemoteAction(android.R.drawable.ic_media_previous, BROADCAST_ACTION_PREV, "Prev", "Play Previous"));
actions.add(generateRemoteAction(android.R.drawable.ic_media_play, BROADCAST_ACTION_PLAYPAUSE, "Play/Pause", "Play or Pause"));
actions.add(generateRemoteAction(android.R.drawable.ic_media_next, BROADCAST_ACTION_NEXT, "Next", "Play Next"));
PictureInPictureParams params = new PictureInPictureParams.Builder()
.setAspectRatio(ratio)
.setActions(actions).build();
enterPictureInPictureMode(params);
}
PictureInPictureParams params = new PictureInPictureParams.Builder()
.setAspectRatio(ratio)
.setActions(actions).build();
enterPictureInPictureMode(params);

mController.hideBottom();
mVideoView.postDelayed(() -> {
if (!mVideoView.isPlaying()) {
Expand Down Expand Up @@ -1209,9 +1211,7 @@ protected void onPause() {

@RequiresApi(api = Build.VERSION_CODES.O)
private android.app.RemoteAction generateRemoteAction(int iconResId, int actionCode, String title, String desc) {

final PendingIntent intent =
PendingIntent.getBroadcast(
final PendingIntent intent = PendingIntent.getBroadcast(
PlayActivity.this,
actionCode,
new Intent(BROADCAST_ACTION).putExtra("action", actionCode),
Expand Down

0 comments on commit dec7062

Please sign in to comment.