Browse Source

fix: SegmentLoader.handleUpdateEnd_ run after player was disposed (#711)

Remove handleUpdateEnd event listener after the player is disposed.
pull/6/head
andrewmnlv 9 years ago
committed by David LaPalomento
parent
commit
7244f99cb3
  1. 11
      src/source-updater.js

11
src/source-updater.js

@ -22,7 +22,7 @@ export default class SourceUpdater {
// run completion handlers and process callbacks as updateend
// events fire
this.sourceBuffer_.addEventListener('updateend', () => {
this.onUpdateendCallback_ = () => {
let pendingCallback = this.pendingCallback_;
this.pendingCallback_ = null;
@ -30,9 +30,11 @@ export default class SourceUpdater {
if (pendingCallback) {
pendingCallback();
}
});
this.sourceBuffer_.addEventListener('updateend',
this.runCallback_.bind(this));
this.runCallback_();
};
this.sourceBuffer_.addEventListener('updateend', this.onUpdateendCallback_);
this.runCallback_();
};
@ -162,6 +164,7 @@ export default class SourceUpdater {
* dispose of the source updater and the underlying sourceBuffer
*/
dispose() {
this.sourceBuffer_.removeEventListener('updateend', this.onUpdateendCallback_);
if (this.sourceBuffer_ && this.mediaSource.readyState === 'open') {
this.sourceBuffer_.abort();
}

Loading…
Cancel
Save