MCPcopy Create free account
hub / github.com/coderarmy-notes/mern-stack-course / Video

Function Video

04React/Day08/src/Video.jsx:3–31  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1import { useRef } from "react";
2
3function 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
33export default Video;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected