File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,14 @@ import Image from "next/image";
44import { useEffect , useRef } from "react" ;
55
66export default function Page ( ) {
7+ const videoRef = useRef < HTMLVideoElement > ( null ) ;
8+
9+ function unmuteVideo ( ) {
10+ if ( videoRef . current ) {
11+ videoRef . current . muted = false ;
12+ }
13+ }
14+
715 return (
816 < >
917 < div className = "flex justify-center items-center min-h-screen bg-purple-200" >
@@ -14,7 +22,7 @@ export default function Page() {
1422 width = { 500 }
1523 height = { 500 } />
1624 < div >
17- < video loop autoPlay muted playsInline height = "500" width = "500" >
25+ < video ref = { videoRef } onClick = { unmuteVideo } className = "cursor-pointer" loop autoPlay muted playsInline height = "500" width = "500" >
1826 < source src = "/never-gonna-give-up.mp4" type = "video/mp4" />
1927 </ video >
2028 </ div >
You can’t perform that action at this time.
0 commit comments