Fix orientation issues
This commit is contained in:
parent
f2b46fffe0
commit
dd7d253a1b
|
@ -521,7 +521,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||
isRemote = false;
|
||||
peertubeInstance = b.getString("peertube_instance", Helper.getLiveInstance(PeertubeActivity.this));
|
||||
videoUuid = b.getString("video_uuid", null);
|
||||
setRequestedOrientation(initialOrientation);
|
||||
setRequestedOrientationCustom(initialOrientation);
|
||||
if (comments != null && comments.size() > 0) {
|
||||
int number = comments.size();
|
||||
comments.clear();
|
||||
|
@ -1215,7 +1215,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||
binding.videoContainer.setLayoutParams(param);
|
||||
}
|
||||
}
|
||||
//change();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1301,6 +1300,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||
private void enterVideoMode() {
|
||||
if (playInMinimized && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && player != null) {
|
||||
isPlayInMinimized = true;
|
||||
setRequestedOrientationCustom(initialOrientation);
|
||||
MediaSessionCompat mediaSession = new MediaSessionCompat(this, getPackageName());
|
||||
MediaSessionConnector mediaSessionConnector = new MediaSessionConnector(mediaSession);
|
||||
mediaSessionConnector.setPlayer(player);
|
||||
|
@ -1332,6 +1332,12 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||
closeCommentThread();
|
||||
return;
|
||||
}
|
||||
|
||||
if (fullScreenMode && player != null && player.isPlaying()) {
|
||||
player.setPlayWhenReady(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (playInMinimized && player != null) {
|
||||
enterVideoMode();
|
||||
} else {
|
||||
|
@ -1359,9 +1365,13 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||
binding.bottomVideo.setVisibility(View.GONE);
|
||||
Objects.requireNonNull(getSupportActionBar()).hide();
|
||||
if (videoOrientationType == videoOrientation.LANDSCAPE) {
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||
if (getResources().getConfiguration().orientation != ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
|
||||
setRequestedOrientationCustom(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||
}
|
||||
} else {
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
if (getResources().getConfiguration().orientation != ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
|
||||
setRequestedOrientationCustom(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,
|
||||
|
@ -1850,10 +1860,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||
openFullscreenDialog();
|
||||
} else {
|
||||
closeFullscreenDialog();
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
Handler handler = new Handler();
|
||||
handler.postDelayed(() -> setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR), 2000);
|
||||
|
||||
setRequestedOrientationCustom(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1877,6 +1884,12 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||
});
|
||||
}
|
||||
|
||||
private void setRequestedOrientationCustom(int orientationCustom) {
|
||||
setRequestedOrientation(orientationCustom);
|
||||
Handler handler = new Handler();
|
||||
handler.postDelayed(() -> setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR), 2000);
|
||||
}
|
||||
|
||||
private void initResolution() {
|
||||
PlayerControlView controlView = binding.doubleTapPlayerView.findViewById(R.id.exo_controller);
|
||||
TextView resolution = controlView.findViewById(R.id.resolution);
|
||||
|
|
Loading…
Reference in New Issue