Skip to content

Commit

Permalink
Listen sourceBuffer errors
Browse files Browse the repository at this point in the history
  • Loading branch information
avelad committed May 11, 2023
1 parent b4f1ee2 commit f002610
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/media/media_source_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -1643,15 +1643,26 @@ shaka.media.MediaSourceEngine = class {
}
});

const onError = (event) => {
sourceBufferAdded.reject(event);
};

for (const contentType of streamsByType.keys()) {
const stream = streamsByType.get(contentType);
this.initSourceBuffer_(contentType, stream);
this.eventManager_.listen(this.sourceBuffers_[contentType], 'error',
onError);
}

// Fake a seek to catchup the playhead.
this.video_.currentTime = currentTime;

await sourceBufferAdded;

for (const contentType of streamsByType.keys()) {
this.eventManager_.unlisten(this.sourceBuffers_[contentType], 'error',
onError);
}
} finally {
this.reloadingMediaSource_ = false;
}
Expand Down

0 comments on commit f002610

Please sign in to comment.