Fixing unregister error for noisy audio
This commit is contained in:
parent
9d1ffd77c3
commit
a99e9978de
@ -259,11 +259,14 @@ public class VideoPlayerFragment extends Fragment implements VideoRendererEventL
|
||||
mService.player.setPlayWhenReady(false);
|
||||
}
|
||||
}
|
||||
public void pauseToggle() {
|
||||
public void unPauseVideo() {
|
||||
if (mBound) {
|
||||
mService.player.setPlayWhenReady(!mService.player.getPlayWhenReady());
|
||||
mService.player.setPlayWhenReady(true);
|
||||
}
|
||||
}
|
||||
public boolean isPaused(){
|
||||
return !mService.player.getPlayWhenReady();
|
||||
}
|
||||
public void showControls(boolean value){
|
||||
simpleExoPlayerView.setUseController(value);
|
||||
}
|
||||
|
@ -108,6 +108,7 @@ public class VideoPlayerService extends Service {
|
||||
if (playbackState == ACTION_PLAY) { // this means that play is available, hence the audio is paused or stopped
|
||||
Log.v(TAG, "ACTION_PAUSE: " + playbackState);
|
||||
unregisterReceiver(myNoisyAudioStreamReceiver);
|
||||
myNoisyAudioStreamReceiver=null;
|
||||
}
|
||||
}
|
||||
} );
|
||||
@ -131,9 +132,10 @@ 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);
|
||||
}
|
||||
if (null!=myNoisyAudioStreamReceiver) {
|
||||
this.unregisterReceiver(myNoisyAudioStreamReceiver);
|
||||
myNoisyAudioStreamReceiver=null;
|
||||
}
|
||||
if (player != null) {
|
||||
player.release();
|
||||
player = null;
|
||||
|
Loading…
Reference in New Issue
Block a user