immersive video player

This commit is contained in:
Page Asgardius 2022-08-28 05:13:00 -07:00
parent 7c0312d721
commit 3cf0f1460b
2 changed files with 20 additions and 1 deletions

View file

@ -3,6 +3,7 @@ package asgardius.page.s3manager;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem;
@ -50,6 +51,22 @@ public class VideoPlayer extends AppCompatActivity {
}
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
View decorView = getWindow().getDecorView();
decorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
public void onBackPressed() {
player.release();
finish();

View file

@ -14,7 +14,9 @@
<com.google.android.exoplayer2.ui.StyledPlayerView
android:id="@+id/player_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
android:layout_height="match_parent"
android:keepScreenOn="true"
android:padding="0dp"/>
</FrameLayout>