Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
play(time=2, total=40) {
this.container.play()
this.container.onBuffering()
this.container.onProgress({current: 50})
this.container.playing()
this.container.updateBitrate(480)
this.playback.trigger(Events.PLAYBACK_TIMEUPDATE, {current: time, total: total})
}
constructor(options, plugin) {
this.playback = new HTML5Video(options)
options.playback = this.playback
this.container = new Container(options)
this.plugin = new plugin(this.container)
this.container.addPlugin(this.plugin)
}
constructor(options, plugin) {
this.playback = new HTML5Video(options)
options.playback = this.playback
this.container = new Container(options)
this.plugin = new plugin(this.container)
this.container.addPlugin(this.plugin)
}
bindEvents() {
this.listenTo(this.container, Events.CONTAINER_BITRATE, this.onBitrate)
this.listenTo(this.container, Events.CONTAINER_STOP, this.stopReporting)
this.listenTo(this.container, Events.CONTAINER_ENDED, this.stopReporting)
this.listenToOnce(this.container.playback, Events.PLAYBACK_PLAY_INTENT, this.startTimers)
this.listenToOnce(this.container, Events.CONTAINER_PLAY, this.onFirstPlaying)
this.listenTo(this.container, Events.CONTAINER_PLAY, this.onPlay)
this.listenTo(this.container, Events.CONTAINER_PAUSE, this.onPause)
this.listenToOnce(this.container, Events.CONTAINER_STATE_BUFFERING, this.onBuffering)
this.listenTo(this.container, Events.CONTAINER_SEEK, this.onSeek)
this.listenTo(this.container, Events.CONTAINER_ERROR, () => this._inc('error'))
this.listenTo(this.container, Events.CONTAINER_FULLSCREEN, () => this._inc('fullscreen'))
this.listenTo(this.container, Events.CONTAINER_PLAYBACKDVRSTATECHANGED, (dvrInUse) => {dvrInUse && this._inc('dvrUsage')})
this.listenTo(this.container.playback, Events.PLAYBACK_PROGRESS, this.onProgress)
this.listenTo(this.container.playback, Events.PLAYBACK_TIMEUPDATE, this.onTimeUpdate)
}
bindEvents() {
this.listenTo(this.container, Events.CONTAINER_BITRATE, this.onBitrate)
this.listenTo(this.container, Events.CONTAINER_STOP, this.stopReporting)
this.listenTo(this.container, Events.CONTAINER_ENDED, this.stopReporting)
this.listenToOnce(this.container.playback, Events.PLAYBACK_PLAY_INTENT, this.startTimers)
this.listenToOnce(this.container, Events.CONTAINER_PLAY, this.onFirstPlaying)
this.listenTo(this.container, Events.CONTAINER_PLAY, this.onPlay)
this.listenTo(this.container, Events.CONTAINER_PAUSE, this.onPause)
this.listenToOnce(this.container, Events.CONTAINER_STATE_BUFFERING, this.onBuffering)
this.listenTo(this.container, Events.CONTAINER_SEEK, this.onSeek)
this.listenTo(this.container, Events.CONTAINER_ERROR, () => this._inc('error'))
this.listenTo(this.container, Events.CONTAINER_FULLSCREEN, () => this._inc('fullscreen'))
this.listenTo(this.container, Events.CONTAINER_PLAYBACKDVRSTATECHANGED, (dvrInUse) => {dvrInUse && this._inc('dvrUsage')})
this.listenTo(this.container.playback, Events.PLAYBACK_PROGRESS, this.onProgress)
this.listenTo(this.container.playback, Events.PLAYBACK_TIMEUPDATE, this.onTimeUpdate)
}
bindEvents() {
this.listenTo(this.container, Events.CONTAINER_BITRATE, this.onBitrate)
this.listenTo(this.container, Events.CONTAINER_STOP, this.stopReporting)
this.listenTo(this.container, Events.CONTAINER_ENDED, this.stopReporting)
this.listenToOnce(this.container.playback, Events.PLAYBACK_PLAY_INTENT, this.startTimers)
this.listenToOnce(this.container, Events.CONTAINER_PLAY, this.onFirstPlaying)
this.listenTo(this.container, Events.CONTAINER_PLAY, this.onPlay)
this.listenTo(this.container, Events.CONTAINER_PAUSE, this.onPause)
this.listenToOnce(this.container, Events.CONTAINER_STATE_BUFFERING, this.onBuffering)
this.listenTo(this.container, Events.CONTAINER_SEEK, this.onSeek)
this.listenTo(this.container, Events.CONTAINER_ERROR, () => this._inc('error'))
this.listenTo(this.container, Events.CONTAINER_FULLSCREEN, () => this._inc('fullscreen'))
this.listenTo(this.container, Events.CONTAINER_PLAYBACKDVRSTATECHANGED, (dvrInUse) => {dvrInUse && this._inc('dvrUsage')})
this.listenTo(this.container.playback, Events.PLAYBACK_PROGRESS, this.onProgress)
this.listenTo(this.container.playback, Events.PLAYBACK_TIMEUPDATE, this.onTimeUpdate)
}
_onCompletion() {
let currentPercentage = this._metrics.extra.watchedPercentage
let allPercentages = this._completion.watch
let isCalled = this._completion.calls.indexOf(currentPercentage) != -1
if (allPercentages.indexOf(currentPercentage) != -1 && !isCalled) {
Log.info(this.name + ' PERCENTAGE_EVENT: ' + currentPercentage)
this._completion.calls.push(currentPercentage)
this.trigger(ClapprStats.PERCENTAGE_EVENT, currentPercentage)
}
}
bindEvents() {
this.listenTo(this.container, Events.CONTAINER_BITRATE, this.onBitrate)
this.listenTo(this.container, Events.CONTAINER_STOP, this.stopReporting)
this.listenTo(this.container, Events.CONTAINER_ENDED, this.stopReporting)
this.listenToOnce(this.container.playback, Events.PLAYBACK_PLAY_INTENT, this.startTimers)
this.listenToOnce(this.container, Events.CONTAINER_PLAY, this.onFirstPlaying)
this.listenTo(this.container, Events.CONTAINER_PLAY, this.onPlay)
this.listenTo(this.container, Events.CONTAINER_PAUSE, this.onPause)
this.listenToOnce(this.container, Events.CONTAINER_STATE_BUFFERING, this.onBuffering)
this.listenTo(this.container, Events.CONTAINER_SEEK, this.onSeek)
this.listenTo(this.container, Events.CONTAINER_ERROR, () => this._inc('error'))
this.listenTo(this.container, Events.CONTAINER_FULLSCREEN, () => this._inc('fullscreen'))
this.listenTo(this.container, Events.CONTAINER_PLAYBACKDVRSTATECHANGED, (dvrInUse) => {dvrInUse && this._inc('dvrUsage')})
this.listenTo(this.container.playback, Events.PLAYBACK_PROGRESS, this.onProgress)
this.listenTo(this.container.playback, Events.PLAYBACK_TIMEUPDATE, this.onTimeUpdate)
}
bindEvents() {
this.listenTo(this.container, Events.CONTAINER_BITRATE, this.onBitrate)
this.listenTo(this.container, Events.CONTAINER_STOP, this.stopReporting)
this.listenTo(this.container, Events.CONTAINER_ENDED, this.stopReporting)
this.listenToOnce(this.container.playback, Events.PLAYBACK_PLAY_INTENT, this.startTimers)
this.listenToOnce(this.container, Events.CONTAINER_PLAY, this.onFirstPlaying)
this.listenTo(this.container, Events.CONTAINER_PLAY, this.onPlay)
this.listenTo(this.container, Events.CONTAINER_PAUSE, this.onPause)
this.listenToOnce(this.container, Events.CONTAINER_STATE_BUFFERING, this.onBuffering)
this.listenTo(this.container, Events.CONTAINER_SEEK, this.onSeek)
this.listenTo(this.container, Events.CONTAINER_ERROR, () => this._inc('error'))
this.listenTo(this.container, Events.CONTAINER_FULLSCREEN, () => this._inc('fullscreen'))
this.listenTo(this.container, Events.CONTAINER_PLAYBACKDVRSTATECHANGED, (dvrInUse) => {dvrInUse && this._inc('dvrUsage')})
this.listenTo(this.container.playback, Events.PLAYBACK_PROGRESS, this.onProgress)
this.listenTo(this.container.playback, Events.PLAYBACK_TIMEUPDATE, this.onTimeUpdate)
}
bindEvents() {
this.listenTo(this.container, Events.CONTAINER_BITRATE, this.onBitrate)
this.listenTo(this.container, Events.CONTAINER_STOP, this.stopReporting)
this.listenTo(this.container, Events.CONTAINER_ENDED, this.stopReporting)
this.listenToOnce(this.container.playback, Events.PLAYBACK_PLAY_INTENT, this.startTimers)
this.listenToOnce(this.container, Events.CONTAINER_PLAY, this.onFirstPlaying)
this.listenTo(this.container, Events.CONTAINER_PLAY, this.onPlay)
this.listenTo(this.container, Events.CONTAINER_PAUSE, this.onPause)
this.listenToOnce(this.container, Events.CONTAINER_STATE_BUFFERING, this.onBuffering)
this.listenTo(this.container, Events.CONTAINER_SEEK, this.onSeek)
this.listenTo(this.container, Events.CONTAINER_ERROR, () => this._inc('error'))
this.listenTo(this.container, Events.CONTAINER_FULLSCREEN, () => this._inc('fullscreen'))
this.listenTo(this.container, Events.CONTAINER_PLAYBACKDVRSTATECHANGED, (dvrInUse) => {dvrInUse && this._inc('dvrUsage')})
this.listenTo(this.container.playback, Events.PLAYBACK_PROGRESS, this.onProgress)
this.listenTo(this.container.playback, Events.PLAYBACK_TIMEUPDATE, this.onTimeUpdate)
}