Skip to content

Commit

Permalink
fix: Fix HLS lazy-loading exception during update
Browse files Browse the repository at this point in the history
If a stream switch occurs during a playlist update, that update may
need to be cancelled.  This handles this edge case to prevent an
exception trying to access stream.segmentIndex.

Closes #4647
  • Loading branch information
joeyparrish committed Nov 3, 2022
1 parent 4e75ec6 commit 1df4bff
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/hls/hls_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,10 @@ shaka.hls.HlsParser = class {
uriObj.setQueryData(new goog.Uri.QueryData('_HLS_skip=YES'));
}
const response = await this.requestManifest_(uriObj.toString());
if (!streamInfo.stream.segmentIndex) {
// The stream was closed since the update was first requested.
return;
}

/** @type {shaka.hls.Playlist} */
const playlist = this.manifestTextParser_.parsePlaylist(
Expand Down

0 comments on commit 1df4bff

Please sign in to comment.