16 lines
316 B
JavaScript
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();
|
|
}
|
|
}
|
|
};
|