()
| 1 | import { useRef } from "react"; |
| 2 | |
| 3 | function Video(){ |
| 4 | |
| 5 | const videoRef = useRef(null); |
| 6 | |
| 7 | function handleStart(){ |
| 8 | videoRef.current.play(); |
| 9 | } |
| 10 | |
| 11 | |
| 12 | function handleStop(){ |
| 13 | videoRef.current.pause(); |
| 14 | } |
| 15 | |
| 16 | |
| 17 | function handleRestart(){ |
| 18 | videoRef.current.currentTime = 0; |
| 19 | } |
| 20 | |
| 21 | return( |
| 22 | <> |
| 23 | <video ref={videoRef} src="/strike.mp4" width="600" height="400"></video> |
| 24 | <div> |
| 25 | <button onClick={handleStart}>start</button> |
| 26 | <button onClick={handleStop}>pause</button> |
| 27 | <button onClick={handleRestart}>Restart</button> |
| 28 | </div> |
| 29 | </> |
| 30 | ) |
| 31 | } |
| 32 | |
| 33 | export default Video; |
nothing calls this directly
no outgoing calls
no test coverage detected