fixing duplicate controlelrs

This commit is contained in:
dhk2 2020-06-28 07:49:36 -07:00
parent 6b26de862d
commit d525da2863
2 changed files with 8 additions and 4 deletions

View File

@ -61,7 +61,6 @@ import static net.schueller.peertube.helper.Constants.THEME_PREF_KEY;
public class VideoPlayActivity extends AppCompatActivity { public class VideoPlayActivity extends AppCompatActivity {
private static final String TAG = "VideoPlayActivity"; private static final String TAG = "VideoPlayActivity";
VideoPlayerFragment videoPlayerFragment;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -109,7 +108,7 @@ public class VideoPlayActivity extends AppCompatActivity {
protected void onNewIntent(Intent intent) { protected void onNewIntent(Intent intent) {
super.onNewIntent(intent); super.onNewIntent(intent);
setIntent(intent); setIntent(intent);
videoPlayerFragment = (VideoPlayerFragment) VideoPlayerFragment videoPlayerFragment = (VideoPlayerFragment)
getSupportFragmentManager().findFragmentById(R.id.video_player_fragment); getSupportFragmentManager().findFragmentById(R.id.video_player_fragment);
assert videoPlayerFragment != null; assert videoPlayerFragment != null;
String videoUuid = intent.getStringExtra(VideoListActivity.EXTRA_VIDEOID); String videoUuid = intent.getStringExtra(VideoListActivity.EXTRA_VIDEOID);
@ -287,7 +286,7 @@ public class VideoPlayActivity extends AppCompatActivity {
public void onBackPressed() { public void onBackPressed() {
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
videoPlayerFragment = (VideoPlayerFragment) VideoPlayerFragment videoPlayerFragment = (VideoPlayerFragment)
getSupportFragmentManager().findFragmentById(R.id.video_player_fragment); getSupportFragmentManager().findFragmentById(R.id.video_player_fragment);
//copying Youtube behavior to have back button exit full screen. //copying Youtube behavior to have back button exit full screen.
@ -353,6 +352,9 @@ public class VideoPlayActivity extends AppCompatActivity {
} }
@Override @Override
public void onPictureInPictureModeChanged (boolean isInPictureInPictureMode, Configuration newConfig) { public void onPictureInPictureModeChanged (boolean isInPictureInPictureMode, Configuration newConfig) {
FragmentManager fragmentManager = getSupportFragmentManager();
VideoPlayerFragment videoPlayerFragment = (VideoPlayerFragment) fragmentManager.findFragmentById(R.id.video_player_fragment);
if (isInPictureInPictureMode) { if (isInPictureInPictureMode) {
Log.v(TAG,"switched to pip "); Log.v(TAG,"switched to pip ");
videoPlayerFragment.useController(false); videoPlayerFragment.useController(false);

View File

@ -200,7 +200,9 @@ public class VideoPlayerFragment extends Fragment implements VideoRendererEventL
}); });
} }
public void useController(boolean value){ public void useController(boolean value){
simpleExoPlayerView.setUseController(value); if (mBound){
simpleExoPlayerView.setUseController(value);
}
} }
private void playVideo(Video video) { private void playVideo(Video video) {