-
Notifications
You must be signed in to change notification settings - Fork 154
/
App.tsx
48 lines (38 loc) · 1.17 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
import React, { useEffect, useRef } from 'react';
import './App.css';
import { Player, Video, DefaultUi, 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<HTMLVmPlayerElement>(null);
const onPlaybackReady = () => {
// ...
};
// If you prefer hooks :)
const [currentTime] = usePlayerContext(player, 'currentTime', 0);
useEffect(() => {
console.log(currentTime);
}, [currentTime]);
return (
<div id="container">
<Player playsinline ref={player} onVmPlaybackReady={onPlaybackReady}>
<Video poster="https://files.vidstack.io/agent-327/poster.png">
<source
data-src="https://files.vidstack.io/agent-327/720p.mp4"
type="video/mp4"
/>
</Video>
<DefaultUi>
{/* Custom UI Component. */}
<TapSidesToSeek />
</DefaultUi>
</Player>
</div>
);
}
export default App;