Throw an error if the media player which has completed is not the expected one
This commit is contained in:
parent
8a2f28bc37
commit
169c9b221c
@ -436,7 +436,11 @@ class VoiceBroadcastPlayerImpl @Inject constructor(
|
|||||||
override fun onCompletion(mp: MediaPlayer) {
|
override fun onCompletion(mp: MediaPlayer) {
|
||||||
// Release media player as soon as it completed
|
// Release media player as soon as it completed
|
||||||
mp.release()
|
mp.release()
|
||||||
currentMediaPlayer = null
|
if (currentMediaPlayer == mp) {
|
||||||
|
currentMediaPlayer = null
|
||||||
|
} else {
|
||||||
|
error("The media player which has completed mismatches the current media player instance.")
|
||||||
|
}
|
||||||
|
|
||||||
// Next media player is already attached to this player and will start playing automatically
|
// Next media player is already attached to this player and will start playing automatically
|
||||||
if (nextMediaPlayer != null) return
|
if (nextMediaPlayer != null) return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user