mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 09:25:49 +03:00
Throw an error if the media player which has completed is not the expected one
This commit is contained in:
parent
8a2f28bc37
commit
169c9b221c
1 changed files with 5 additions and 1 deletions
|
@ -436,7 +436,11 @@ class VoiceBroadcastPlayerImpl @Inject constructor(
|
|||
override fun onCompletion(mp: MediaPlayer) {
|
||||
// Release media player as soon as it completed
|
||||
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
|
||||
if (nextMediaPlayer != null) return
|
||||
|
|
Loading…
Reference in a new issue