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);
|
mService.player.setPlayWhenReady(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void pauseToggle() {
|
public void unPauseVideo() {
|
||||||
if (mBound) {
|
if (mBound) {
|
||||||
mService.player.setPlayWhenReady(!mService.player.getPlayWhenReady());
|
mService.player.setPlayWhenReady(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public boolean isPaused(){
|
||||||
|
return !mService.player.getPlayWhenReady();
|
||||||
|
}
|
||||||
public void showControls(boolean value){
|
public void showControls(boolean value){
|
||||||
simpleExoPlayerView.setUseController(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
|
if (playbackState == ACTION_PLAY) { // this means that play is available, hence the audio is paused or stopped
|
||||||
Log.v(TAG, "ACTION_PAUSE: " + playbackState);
|
Log.v(TAG, "ACTION_PAUSE: " + playbackState);
|
||||||
unregisterReceiver(myNoisyAudioStreamReceiver);
|
unregisterReceiver(myNoisyAudioStreamReceiver);
|
||||||
|
myNoisyAudioStreamReceiver=null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
@ -131,9 +132,10 @@ 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) {
|
if (null!=myNoisyAudioStreamReceiver) {
|
||||||
this.unregisterReceiver(myNoisyAudioStreamReceiver);
|
this.unregisterReceiver(myNoisyAudioStreamReceiver);
|
||||||
}
|
myNoisyAudioStreamReceiver=null;
|
||||||
|
}
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
player.release();
|
player.release();
|
||||||
player = null;
|
player = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user