Skip to content

Commit

Permalink
Reset Playback Engine on PlaybackInfo fetch error
Browse files Browse the repository at this point in the history
This can happen at two points:
* On load for the current item, which is when the PBI fetch error is raised as
a player error.
* On playback start of the next item, which when the PBI fetch error is raised
as a player error. While this delays the issue, it is good, because it allows
playback of the current item to finish.
  • Loading branch information
stoyicker committed Aug 21, 2024
1 parent 693595f commit 88a8ca4
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -802,12 +802,17 @@ internal class ExoPlayerPlaybackEngine(
}

val eventError = errorHandler.getErrorEvent(error, forwardingMediaProduct?.productType)
coroutineScope.launch {
eventSink.emit(eventError)
}
playbackInfoFetchException.report(errorMessage, eventError.errorCode)
val matchingMediaProduct = eventTime.correspondingForwardingMediaProductIfMatching
if (matchingMediaProduct === forwardingMediaProduct ||
matchingMediaProduct === nextForwardingMediaProduct
) {
if (matchingMediaProduct === forwardingMediaProduct) {
if (playbackInfoFetchException != null) {
reset()
} else if (matchingMediaProduct === forwardingMediaProduct) {
val positionInSeconds =
if (forwardingMediaProduct?.productType == ProductType.BROADCAST) {
extendedExoPlayer.currentPositionSinceEpochMs
Expand All @@ -822,9 +827,6 @@ internal class ExoPlayerPlaybackEngine(
)
}
}
coroutineScope.launch {
eventSink.emit(eventError)
}
}

override fun onVideoSizeChanged(eventTime: EventTime, videoSize: VideoSize) {
Expand Down

0 comments on commit 88a8ca4

Please sign in to comment.