-
Notifications
You must be signed in to change notification settings - Fork 7
/
App.vue
109 lines (106 loc) · 2.95 KB
/
App.vue
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<script setup lang="ts">
import { reactive } from 'vue';
import { VGithubIcon } from 'v-github-icon';
import { VClappr } from 'v-clappr';
import type { Player } from '@clappr/core';
const state = reactive({
clappr: null as Player | null,
source: 'https://download.samplelib.com/mp4/sample-30s.mp4',
poster: 'http://clappr.io/poster.png',
options: {
width: '100%',
height: '100%',
autoPlay: false,
mute: false,
loop: false,
language: 'en-US',
playbackNotSupportedMessage: 'Playback not supported',
autoSeekFromUrl: true,
includeResetStyle: true,
playback: {
preload: 'metadata',
disableContextMenu: true,
controls: false,
crossOrigin: null,
playInline: false,
minimumDvrSize: null,
externalTracks: [],
hlsjsConfig: {},
shakaConfiguration: {},
},
},
});
const onInit = (player: Player) => {
console.log('onInit Event: ', player);
state.clappr = player;
};
const onResize = (e: { width: number; height: number }) => {
console.log('onResize Event: ', e);
};
const onPlay = (e: boolean) => {
console.log('onPlay Event: ', e);
};
const onPause = (e: boolean) => {
console.log('onPause Event: ', e);
};
const onStop = (e: boolean) => {
console.log('onStop Event: ', e);
};
const onEnded = (e: boolean) => {
console.log('onEnded Event: ', e);
};
const onSeek = (e: number) => {
console.log('onSeek Event: ', e);
};
const onError = (e: Error) => {
console.log('onError Event: ', e);
};
const onTimeUpdated = (e: { current: number; total: number }) => {
console.log('onTimeUpdate Event: ', e);
};
const onVolumeUpdated = (e: number) => {
console.log('onVolumeUpdate Event: ', e);
};
const onSubtitleAvailable = (e: boolean) => {
console.log('onSubtitleAvailable Event: ', e);
};
</script>
<template>
<main class="w-screen h-screen bg-gradient-49">
<v-github-icon url="https://github.com/vinayakkulkarni/v-clappr" />
<v-clappr
el="player"
:source="state.source"
:options="state.options"
class="mx-auto w-1/2 h-full"
@init="onInit"
@resize="onResize"
@play="onPlay"
@pause="onPause"
@stop="onStop"
@ended="onEnded"
@seek="onSeek"
@error="onError"
@time-updated="onTimeUpdated"
@volume-updated="onVolumeUpdated"
@subtitle-available="onSubtitleAvailable"
/>
<div class="absolute bottom-4 right-4">
<a
href="https://app.netlify.com/sites/v-clappr/deploys"
aria-label="View deploys on Netlify"
target="_blank"
rel="noopener noreferrer"
class="gray-400"
>
<img
src="https://www.netlify.com/img/global/badges/netlify-color-accent.svg"
alt="Deploys by Netlify"
/>
</a>
</div>
</main>
</template>
<style scoped>
@import 'v-github-icon/dist/v-github-icon.css';
</style>