Do not call error handler when shutting down playback service
This commit is contained in:
parent
9fb695822a
commit
1331c92c1d
|
@ -610,13 +610,26 @@ public class LocalPSMP extends PlaybackServiceMediaPlayer {
|
||||||
executor.shutdown();
|
executor.shutdown();
|
||||||
if (mediaPlayer != null) {
|
if (mediaPlayer != null) {
|
||||||
try {
|
try {
|
||||||
mediaPlayer.stop();
|
removeMediaPlayerErrorListener();
|
||||||
|
if (mediaPlayer.isPlaying()) {
|
||||||
|
mediaPlayer.stop();
|
||||||
|
}
|
||||||
} catch (Exception ignore) { }
|
} catch (Exception ignore) { }
|
||||||
mediaPlayer.release();
|
mediaPlayer.release();
|
||||||
}
|
}
|
||||||
releaseWifiLockIfNecessary();
|
releaseWifiLockIfNecessary();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void removeMediaPlayerErrorListener() {
|
||||||
|
if (mediaPlayer instanceof VideoPlayer) {
|
||||||
|
VideoPlayer vp = (VideoPlayer) mediaPlayer;
|
||||||
|
vp.setOnErrorListener((mp, what, extra) -> true);
|
||||||
|
} else if (mediaPlayer instanceof AudioPlayer) {
|
||||||
|
AudioPlayer ap = (AudioPlayer) mediaPlayer;
|
||||||
|
ap.setOnErrorListener((mediaPlayer, i, i1) -> true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Releases internally used resources. This method should only be called when the object is not used anymore.
|
* Releases internally used resources. This method should only be called when the object is not used anymore.
|
||||||
* This method is executed on an internal executor service.
|
* This method is executed on an internal executor service.
|
||||||
|
|
Loading…
Reference in New Issue