Do not enter in error state in case of cancellation exception
This commit is contained in:
parent
3ce757ee4b
commit
a0ab6de85a
|
@ -252,10 +252,12 @@ class VoiceBroadcastPlayerImpl @Inject constructor(
|
||||||
|
|
||||||
onNextMediaPlayerStarted(mp)
|
onNextMediaPlayerStarted(mp)
|
||||||
} catch (failure: VoiceBroadcastFailure.ListeningError) {
|
} catch (failure: VoiceBroadcastFailure.ListeningError) {
|
||||||
|
if (failure.cause !is CancellationException) {
|
||||||
playingState = State.Error(failure)
|
playingState = State.Error(failure)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun pausePlayback() {
|
private fun pausePlayback() {
|
||||||
playingState = State.Paused // This will trigger a playing state update and save the current position
|
playingState = State.Paused // This will trigger a playing state update and save the current position
|
||||||
|
@ -313,7 +315,7 @@ class VoiceBroadcastPlayerImpl @Inject constructor(
|
||||||
} catch (failure: VoiceBroadcastFailure.ListeningError) {
|
} catch (failure: VoiceBroadcastFailure.ListeningError) {
|
||||||
// Do not change the playingState if the current player is still valid,
|
// Do not change the playingState if the current player is still valid,
|
||||||
// the error will be thrown again when switching to the next player
|
// the error will be thrown again when switching to the next player
|
||||||
if (playingState == State.Buffering || tryOrNull { currentMediaPlayer?.isPlaying } != true) {
|
if (failure.cause !is CancellationException && (playingState == State.Buffering || tryOrNull { currentMediaPlayer?.isPlaying } != true)) {
|
||||||
playingState = State.Error(failure)
|
playingState = State.Error(failure)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue