import React, { useEffect, useState } from 'react'; import { Play, Pause, VolumeOff, VolumeUp, ClosedCaption, ClosedCaptionDisabled, } from '../../assets/icons'; const PlayerControls = (props) => { const { hasCaptionTrack, player, showCaptions } = props; const [muted, setMuted] = useState(false); const [paused, setPaused] = useState(false); useEffect(() => { setMuted(player.isMuted()); }, [player]); const toggleMute = () => { const shouldMute = !player.isMuted(); player.setMuted(shouldMute); setMuted(shouldMute); }; const togglePause = () => { const shouldPause = !player.isPaused(); if (shouldPause) { player.pause(); } else { player.play(); } setPaused(shouldPause); }; return (
{hasCaptionTrack && ( )}
); }; export default PlayerControls;