Skip to content

Commit

Permalink
Merge pull request #191 from dhk2/develop
Browse files Browse the repository at this point in the history
fix the duplicate controllers in floating mode, and a possible crashing bug
  • Loading branch information
sschueller authored Jun 28, 2020
2 parents f942e27 + 5da8d68 commit a7874e3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,16 @@ public void enterPipMode() {
}
@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);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,11 @@ public void onFailure(@NonNull Call<Video> call, @NonNull Throwable t) {
}
});
}

public void useController(boolean value){
if (mBound){
simpleExoPlayerView.setUseController(value);
}
}
private void playVideo(Video video) {

Context context = getContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,12 @@ public void onDestroy() {
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();
Expand Down

0 comments on commit a7874e3

Please sign in to comment.