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
|
@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);
|
||||||
} else {
|
} else {
|
||||||
Log.v(TAG,"switched to normal");
|
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) {
|
private void playVideo(Video video) {
|
||||||
|
|
||||||
Context context = getContext();
|
Context context = getContext();
|
||||||
|
@ -130,8 +130,12 @@ public class VideoPlayerService extends Service {
|
|||||||
playerNotificationManager.setPlayer(null);
|
playerNotificationManager.setPlayer(null);
|
||||||
}
|
}
|
||||||
//Was seeing an error when exiting the program about about not unregistering the receiver.
|
//Was seeing an error when exiting the program about about not unregistering the receiver.
|
||||||
if (null!=myNoisyAudioStreamReceiver) {
|
try {
|
||||||
this.unregisterReceiver(myNoisyAudioStreamReceiver);
|
if (null!=myNoisyAudioStreamReceiver) {
|
||||||
|
this.unregisterReceiver(myNoisyAudioStreamReceiver);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e("VideoPlayerService", "attempted to unregister a nonregistered service");
|
||||||
}
|
}
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
player.release();
|
player.release();
|
||||||
|
Loading…
Reference in New Issue
Block a user