Merge pull request #191 from dhk2/develop
fix the duplicate controllers in floating mode, and a possible crashing bug
This commit is contained in:
commit
a7874e35fe
@ -353,10 +353,16 @@ public class VideoPlayActivity extends AppCompatActivity {
|
||||
}
|
||||
@Override
|
||||
public void onPictureInPictureModeChanged (boolean isInPictureInPictureMode, Configuration newConfig) {
|
||||
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||
VideoPlayerFragment videoPlayerFragment = (VideoPlayerFragment) fragmentManager.findFragmentById(R.id.video_player_fragment);
|
||||
|
||||
if (isInPictureInPictureMode) {
|
||||
Log.v(TAG,"switched to pip ");
|
||||
videoPlayerFragment.useController(false);
|
||||
} else {
|
||||
Log.v(TAG,"switched to normal");
|
||||
videoPlayerFragment.useController(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -199,7 +199,11 @@ public class VideoPlayerFragment extends Fragment implements VideoRendererEventL
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void useController(boolean value){
|
||||
if (mBound){
|
||||
simpleExoPlayerView.setUseController(value);
|
||||
}
|
||||
}
|
||||
private void playVideo(Video video) {
|
||||
|
||||
Context context = getContext();
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user