We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8711618 commit a51449fCopy full SHA for a51449f
src/components/PlayerVideo/index.js
@@ -1,8 +1,17 @@
1
-import React from "react";
+import React, { useRef } from "react";
2
3
function PlayerVideo() {
4
+ const video = useRef(null);
5
+
6
+ const playAndPause = () =>
7
+ video.current.paused ? video.current.play() : video.current.pause();
8
9
return (
- <video src="http://sveltejs.github.io/assets/caminandes-llamigos.mp4"></video>
10
+ <video
11
+ ref={video}
12
+ onClick={playAndPause}
13
+ src="http://sveltejs.github.io/assets/caminandes-llamigos.mp4"
14
+ ></video>
15
);
16
}
17
0 commit comments