Skip to content

Commit

Permalink
Merge pull request #1212 from clappr/fix-html5video-autoplay-after-de…
Browse files Browse the repository at this point in the history
…stroy

Fix Html5Video autoplay after playback destroyed
  • Loading branch information
towerz committed Nov 19, 2016
2 parents bd2be9d + a169365 commit ca38748
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/playbacks/html5_video/html5_video.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export default class HTML5Video extends Playback {

constructor(...args) {
super(...args)
this._destroyed = false
this._loadStarted = false
this._playheadMoving = false
this._playheadMovingTimer = null
Expand Down Expand Up @@ -118,7 +119,7 @@ export default class HTML5Video extends Playback {
this.settings.right = ['fullscreen', 'volume', 'hd-indicator']

// https://github.com/clappr/clappr/issues/1076
this.options.autoPlay && process.nextTick(() => this.play())
this.options.autoPlay && process.nextTick(() => !this._destroyed && this.play())
}

/**
Expand Down Expand Up @@ -320,6 +321,7 @@ export default class HTML5Video extends Playback {
}

destroy() {
this._destroyed = true
this.$el.remove()
this.el.src = ''
this._src = null
Expand Down

0 comments on commit ca38748

Please sign in to comment.