Skip to content

Commit

Permalink
fix: prevent bad calls to MediaSource.endOfStream
Browse files Browse the repository at this point in the history
  • Loading branch information
martinstark committed Mar 8, 2023
1 parent 05a1abc commit e7892d9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/media/media_source_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -1056,8 +1056,10 @@ shaka.media.MediaSourceEngine = class {
async endOfStream(reason) {
await this.enqueueBlockingOperation_(() => {
// If endOfStream() has already been called on the media source,
// don't call it again.
if (this.ended()) {
// don't call it again. Also do not call if readyState is
// 'closed' (not attached to video element) since it is not a
// valid operation.
if (this.ended() || this.mediaSource_.readyState === 'closed') {
return;
}
// Tizen won't let us pass undefined, but it will let us omit the
Expand Down

0 comments on commit e7892d9

Please sign in to comment.