Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
},
disableVideoTagContextMenu: true
})
this.player.on(Clappr.Events.PLAYER_PLAY, () => {
// seek video on first player play, this will fix it on mobile too!
if (media.playhead && !this.seeked) {
this.player.seek(media.playhead)
}
// run the callback
playCallback()
this.seeked = true
})
this.player.on(Clappr.Events.PLAYER_PAUSE, () => {
this.logTime()
})
this.player.on(Clappr.Events.PLAYER_ENDED, () => {
this.logTime(media.duration)
})
this.player.on(Clappr.Events.PLAYER_ERROR, (error) => console.error('Error', error))
}
}
seriesTitle: media.collection_name,
episode: media.episode_number || null
}
},
playbackRateConfig: {
defaultValue: '1.0',
options: [
{value: '0.5', label: '0.5x'},
{value: '1.0', label: '1x'},
{value: '1.5', label: '1.5x'},
{value: '2.0', label: '2x'}
]
},
disableVideoTagContextMenu: true
})
this.player.on(Clappr.Events.PLAYER_PLAY, () => {
// seek video on first player play, this will fix it on mobile too!
if (media.playhead && !this.seeked) {
this.player.seek(media.playhead)
}
// run the callback
playCallback()
this.seeked = true
})
this.player.on(Clappr.Events.PLAYER_PAUSE, () => {
this.logTime()
})
this.player.on(Clappr.Events.PLAYER_ENDED, () => {
this.logTime(media.duration)
})
this.player.on(Clappr.Events.PLAYER_ERROR, (error) => console.error('Error', error))
}
componentDidMount() {
this.player = new Clappr.Player({
parent: this.playerRef,
source: '',
width: '0',
height: '0',
autoPlay: false,
hlsjsConfig: {
enableWorker: true,
},
});
const Events = Clappr.Events;
this.player.on(Events.PLAYER_TIMEUPDATE, progress => {
this.props.dispatch.player.setTime({ currentTime: progress.current, totalTime: progress.total });
});
this.player.on(Events.PLAYER_ENDED, () => {
const { repeat } = this.props.player;
if (repeat) {
this.onPlayNext();
} else {
this.props.dispatch.player.setPaused(true);
}
});
}
addEventListeners() {
super.addEventListeners();
if (this.container) {
this.listenTo(
this.container,
Clappr.Events.CONTAINER_PLAY,
this.updatePlayPauseButton
);
this.listenTo(
this.container,
Clappr.Events.CONTAINER_PAUSE,
this.updatePlayPauseButton
);
}
}