Skip to content
Snippets Groups Projects
Commit 6b18f175 authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Set keep screen flag to video player root view

parent 47299f73
No related branches found
No related tags found
No related merge requests found
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/player_root"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
android:layout_height="fill_parent"
android:keepScreenOn="true" >
<!--
the double FrameLayout is necessary here to do cropping on the bottom right
......@@ -25,8 +27,7 @@
<SurfaceView
android:id="@+id/player_surface"
android:layout_width="1dp"
android:layout_height="1dp"
android:keepScreenOn="true" />
android:layout_height="1dp" />
<SurfaceView
android:id="@+id/subtitles_surface"
......
......@@ -158,6 +158,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
private final PlaybackServiceActivity.Helper mHelper = new PlaybackServiceActivity.Helper(this, this);
private PlaybackService mService;
private View mRootView;
private SurfaceView mSurfaceView = null;
private SurfaceView mSubtitlesSurfaceView = null;
private FrameLayout mSurfaceFrame;
......@@ -360,6 +361,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
mActionBar.setCustomView(R.layout.player_action_bar);
mActionBarView = (ViewGroup) mActionBar.getCustomView();
mRootView = findViewById(R.id.player_root);
mTitle = (TextView) mActionBarView.findViewById(R.id.player_overlay_title);
mSysTime = (TextView) findViewById(R.id.player_overlay_systime);
......@@ -733,7 +735,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
mSurfacesAttached = true;
vlcVout.addCallback(this);
vlcVout.attachViews();
mSurfaceView.setKeepScreenOn(true);
mRootView.setKeepScreenOn(true);
loadMedia();
......@@ -766,7 +768,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
vlcVout.removeCallback(this);
if (mSurfacesAttached)
vlcVout.detachViews();
mSurfaceView.setKeepScreenOn(false);
mRootView.setKeepScreenOn(false);
mHandler.removeCallbacksAndMessages(null);
......@@ -2537,7 +2539,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
*/
private void play() {
mService.play();
mSurfaceView.setKeepScreenOn(true);
mRootView.setKeepScreenOn(true);
}
/**
......@@ -2545,7 +2547,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
*/
private void pause() {
mService.pause();
mSurfaceView.setKeepScreenOn(false);
mRootView.setKeepScreenOn(false);
}
/*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment