Skip to content

Commit

Permalink
Merge pull request Streamedian#62 from mburger81/patch-3
Browse files Browse the repository at this point in the history
Failed to execute 'remove' on 'SourceBuffer'
  • Loading branch information
kreopt authored Oct 29, 2017
2 parents 3189f4d + fdc9f07 commit 226618c
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/core/presentation/mse.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,17 @@ export class MSEBuffer {
this.cleaning = true;
promises.push(new Promise((resolve, reject)=>{
this.cleanResolvers.push(resolve);
this.sourceBuffer.remove(this.sourceBuffer.buffered.start(i), this.sourceBuffer.buffered.end(i));
resolve();
if (!this.sourceBuffer.updating) {
this.sourceBuffer.remove(this.sourceBuffer.buffered.start(i), this.sourceBuffer.buffered.end(i));
resolve();
} else {
this.sourceBuffer.onupdateend = () => {
if (this.sourceBuffer) {
this.sourceBuffer.remove(this.sourceBuffer.buffered.start(i), this.sourceBuffer.buffered.end(i));
}
resolve();
};
}
}));
}
return Promise.all(promises);
Expand Down Expand Up @@ -378,4 +387,4 @@ export class MSE {
this.buffers[track].feed(data);
}
}
}
}

0 comments on commit 226618c

Please sign in to comment.