Skip to content

Commit 8ba2722

Browse files
authored
fix: Prevent unhandled rejections on segment fetch failures (#8313)
When fetch of segments is aborted or cannot succeed due to fetch promise rejection, we may end up with unhandled promise rejections.
1 parent 36db472 commit 8ba2722

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/media/streaming_engine.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1554,7 +1554,10 @@ shaka.media.StreamingEngine = class {
15541554
if (mediaState.segmentPrefetch && mediaState.segmentIterator &&
15551555
!this.audioPrefetchMap_.has(mediaState.stream)) {
15561556
mediaState.segmentPrefetch.evict(reference.startTime);
1557-
mediaState.segmentPrefetch.prefetchSegmentsByTime(reference.startTime);
1557+
mediaState.segmentPrefetch.prefetchSegmentsByTime(reference.startTime)
1558+
// We're treating this call as sync here, so ignore async errors
1559+
// to not propagate them further.
1560+
.catch(() => {});
15581561
}
15591562

15601563
const p = this.fetchAndAppend_(mediaState, presentationTime, reference,

0 commit comments

Comments
 (0)