stream/assets/js/video-controls.js
2021-03-05 00:10:20 +01:00

16 lines
316 B
JavaScript

export const toggleVideoPlaying = ({ player, video, onPlay, onPause }) => {
console.log('video', video);
if (video.isPlaying) {
player.pause();
if (typeof onPause === 'function') {
onPause();
}
} else {
player.play();
if (typeof onPlay === 'function') {
onPlay();
}
}
};