forked from vime-js/vime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.svelte
58 lines (48 loc) · 1.08 KB
/
App.svelte
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
50
51
52
53
54
55
56
57
58
<script lang="ts">
import {
Player,
Video,
DefaultUi,
usePlayerStore,
} from '@vime/svelte';
// Custom UI component.
import TapSidesToSeek from './TapSidesToSeek.svelte';
// Obtain a ref if you need to call any methods.
let player: Player;
/**
* All player properties are available through the store. If you prefer, you could also pass
* properties directly to the player and listen for events.
*/
const { paused } = usePlayerStore(() => player);
const onPlaybackReady = () => {
// ...
};
$: console.log($paused);
</script>
<div id="container">
<Player on:vPlaybackReady={onPlaybackReady} bind:this={player}>
<Video crossOrigin="" poster="https://media.vimejs.com/poster.png">
<source data-src="https://media.vimejs.com/720p.mp4" type="video/mp4">
</Video>
<DefaultUi>
<TapSidesToSeek />
</DefaultUi>
</Player>
</div>
<style>
:global(html),
:global(body) {
width: 100%;
height: 100%;
}
:global(body) {
margin: 0;
display: flex;
align-items: center;
justify-content: center;
}
#container {
width: 100%;
max-width: 960px;
}
</style>