fixing duplicate controlelrs

This commit is contained in:
dhk2 2020-06-28 07:29:40 -07:00
parent 7afb000b47
commit 9eaa9abaec
3 changed files with 14 additions and 5 deletions

View File

@ -61,7 +61,7 @@ import static net.schueller.peertube.helper.Constants.THEME_PREF_KEY;
public class VideoPlayActivity extends AppCompatActivity {
private static final String TAG = "VideoPlayActivity";
VideoPlayerFragment videoPlayerFragment;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -109,7 +109,7 @@ public class VideoPlayActivity extends AppCompatActivity {
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
VideoPlayerFragment videoPlayerFragment = (VideoPlayerFragment)
videoPlayerFragment = (VideoPlayerFragment)
getSupportFragmentManager().findFragmentById(R.id.video_player_fragment);
assert videoPlayerFragment != null;
String videoUuid = intent.getStringExtra(VideoListActivity.EXTRA_VIDEOID);
@ -355,8 +355,11 @@ public class VideoPlayActivity extends AppCompatActivity {
public void onPictureInPictureModeChanged (boolean isInPictureInPictureMode, Configuration newConfig) {
if (isInPictureInPictureMode) {
Log.v(TAG,"switched to pip ");
videoPlayerFragment.useController(false);
} else {
Log.v(TAG,"switched to normal");
videoPlayerFragment.useController(true);
}
}
}

View File

@ -199,7 +199,9 @@ public class VideoPlayerFragment extends Fragment implements VideoRendererEventL
}
});
}
public void useController(boolean value){
simpleExoPlayerView.setUseController(value);
}
private void playVideo(Video video) {
Context context = getContext();

View File

@ -130,8 +130,12 @@ public class VideoPlayerService extends Service {
playerNotificationManager.setPlayer(null);
}
//Was seeing an error when exiting the program about about not unregistering the receiver.
if (null!=myNoisyAudioStreamReceiver) {
this.unregisterReceiver(myNoisyAudioStreamReceiver);
try {
if (null!=myNoisyAudioStreamReceiver) {
this.unregisterReceiver(myNoisyAudioStreamReceiver);
}
} catch (Exception e) {
Log.e("VideoPlayerService", "attempted to unregister a nonregistered service");
}
if (player != null) {
player.release();