-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscratch.txt
65 lines (58 loc) · 1.55 KB
/
scratch.txt
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
<template>
<video-player
class="video-player vjs-big-play-centered"
src="https://vjs.zencdn.net/v/oceans.mp4"
poster="/images/poster/oceans.png"
crossorigin="anonymous"
playsinline
controls
:volume="0.6"
:height="320"
:playback-rates="[0.7, 1.0, 1.5, 2.0]"
@mounted="handleMounted"
@ready="handleEvent($event)"
@play="handleEvent($event)"
@pause="handleEvent($event)"
@ended="handleEvent($event)"
@loadeddata="handleEvent($event)"
@waiting="handleEvent($event)"
@playing="handleEvent($event)"
@canplay="handleEvent($event)"
@canplaythrough="handleEvent($event)"
@timeupdate="handleEvent(player?.currentTime())"
/>
</template>
<script lang="ts">
import { defineComponent, shallowRef } from 'vue'
import { VideoPlayer } from '@videojs-player/vue'
import videojs from 'video.js'
import 'video.js/dist/video-js.css'
type VideoJsPlayer = ReturnType<typeof videojs>
export default defineComponent({
name: 'vue-basic-player-example',
title: 'Basic player (Vue)',
url: import.meta.url,
components: {
VideoPlayer
},
setup() {
const player = shallowRef<VideoJsPlayer>()
const handleMounted = (payload: any) => {
player.value = payload.player
console.log('Basic player mounted', payload)
}
const handleEvent = (log: any) => {
console.log('Basic player event', log)
}
return { player, handleMounted, handleEvent }
}
})
</script>
<style lang="scss" scoped>
@import '@/styles/variables.scss';
@import '@/styles/mixins.scss';
.video-player {
background-color: $black;
width: 100%;
}
</style>