Skip to content

Commit

Permalink
playback only plays when shaka is ready
Browse files Browse the repository at this point in the history
  • Loading branch information
leandromoreira committed Jun 28, 2016
1 parent da15e80 commit 279bce0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import shaka from 'shaka-player'

const SEND_STATS_AT = 30 * 1000
const AUTO = -1
const SHAKA_READY = 'shaka:ready'

export default class DashShakaPlayback extends HTML5Video {
get name() {return 'dash_shaka_playback'}
Expand Down Expand Up @@ -50,7 +51,7 @@ export default class DashShakaPlayback extends HTML5Video {
!this._player && this._setup()

if (!this.isReady) {
this.once(Events.PLAYBACK_READY, this.play)
this.once(SHAKA_READY, this.play)
return
}
super.play()
Expand Down Expand Up @@ -117,6 +118,7 @@ export default class DashShakaPlayback extends HTML5Video {

_loaded() {
this._isShakaReadyState = true
this.trigger(SHAKA_READY)
this._ready()
this._startToSendStats()
this._levels = this.videoTracks().map((videoTrack) => { return {id: videoTrack.id, label: `${videoTrack.height}p`}})
Expand Down

0 comments on commit 279bce0

Please sign in to comment.