forked from vime-js/vime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
49 lines (39 loc) · 1.18 KB
/
App.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import React, { useEffect, useRef } from 'react';
import './App.css';
import { VimePlayer, VimeVideo, VimeDefaultUi, usePlayerContext } from '@vime/react';
// Default theme.
import '@vime/core/themes/default.css';
// Optional light theme (extends default).
// import '@vime/core/themes/light.css';
// Custom UI component.
import TapSidesToSeek from './TapSidesToSeek';
function App() {
// Obtain a ref if you need to call any methods.
const player = useRef<HTMLVimePlayerElement>(null);
const onPlaybackReady = () => {
// ...
};
// If you prefer hooks :)
const [currentTime] = usePlayerContext(player, 'currentTime', 0);
useEffect(() => {
console.log(currentTime);
}, [currentTime]);
return (
<div id="container">
<VimePlayer
playsinline
ref={player}
onVPlaybackReady={onPlaybackReady}
>
<VimeVideo poster="https://media.vimejs.com/poster.png">
<source data-src="https://media.vimejs.com/720p.mp4" type="video/mp4" />
</VimeVideo>
<VimeDefaultUi>
{/* Custom UI Component. */}
<TapSidesToSeek />
</VimeDefaultUi>
</VimePlayer>
</div>
);
}
export default App;