CS3Player: fixed ERROR_CODE_BEHIND_LIVE_WINDOW (#447)

This commit is contained in:
Shif-Jess 2023-04-09 14:37:27 +07:00 committed by GitHub
parent 4ed65f8e07
commit 4f9016713f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -985,12 +985,19 @@ class CS3IPlayer : IPlayer {
// If the Network fails then ignore the exception if the duration is set. // If the Network fails then ignore the exception if the duration is set.
// This is to switch mirrors automatically if the stream has not been fetched, but // This is to switch mirrors automatically if the stream has not been fetched, but
// allow playing the buffer without internet as then the duration is fetched. // allow playing the buffer without internet as then the duration is fetched.
if (error.errorCode == PlaybackException.ERROR_CODE_IO_NETWORK_CONNECTION_FAILED when {
&& exoPlayer?.duration != TIME_UNSET error.errorCode == PlaybackException.ERROR_CODE_IO_NETWORK_CONNECTION_FAILED
) { && exoPlayer?.duration != TIME_UNSET -> {
exoPlayer?.prepare() exoPlayer?.prepare()
} else { }
playerError?.invoke(error) error.errorCode == PlaybackException.ERROR_CODE_BEHIND_LIVE_WINDOW -> {
// Re-initialize player at the current live window default position.
exoPlayer?.seekToDefaultPosition()
exoPlayer?.prepare()
}
else -> {
playerError?.invoke(error)
}
} }
super.onPlayerError(error) super.onPlayerError(error)