Skip to content

Commit

Permalink
refactor: only call _hls.loadSource after MEDIA_ATTACHED event is tri…
Browse files Browse the repository at this point in the history
…ggered if loadSourceBeforePlay is true
  • Loading branch information
joaopaulovieira committed Jan 31, 2021
1 parent 1590770 commit 94f5f13
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/hls.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ export default class HlsjsPlayback extends HTML5Video {
this._ccTracksUpdated = false
this._hls && this._hls.destroy()
this._hls = new HLSJS(assign({}, this.options.playback.hlsjsConfig))
this._hls.once(HLSJS.Events.MEDIA_ATTACHED, () => { this.options.hlsPlayback.loadSourceBeforePlay && this._hls.loadSource(this.options.src) })
this._hls.on(HLSJS.Events.MANIFEST_PARSED, () => this._manifestParsed = true)
this._hls.on(HLSJS.Events.LEVEL_LOADED, (evt, data) => this._updatePlaybackType(evt, data))
this._hls.on(HLSJS.Events.LEVEL_UPDATED, (evt, data) => this._onLevelUpdated(evt, data))
Expand Down

0 comments on commit 94f5f13

Please sign in to comment.