Skip to content

Commit 0d0cb87

Browse files
fix: video player integration with nuxt - [CU-869baghca] (#131)
1 parent 441e6e9 commit 0d0cb87

2 files changed

Lines changed: 6 additions & 18 deletions

File tree

app/components/ui/VideoPlayer.vue

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,11 @@
22
// Import the Vue wrapper
33
import { VideoPlayer } from '@videojs-player/vue';
44
5-
// Import the default videojs to access Player type
6-
import type videojs from 'video.js';
7-
8-
import 'video.js/dist/video-js.css';
9-
105
interface Props {
116
src: string;
127
poster?: string;
138
}
14-
159
const props = defineProps<Props>();
16-
type VideoJsPlayer = ReturnType<typeof videojs>;
17-
18-
function onPlayerReady(player: VideoJsPlayer) {
19-
player.on('click', () => {
20-
if (player.paused()) {
21-
player.play();
22-
} else {
23-
player.pause();
24-
}
25-
});
26-
}
2710
</script>
2811

2912
<template>
@@ -44,6 +27,5 @@ function onPlayerReady(player: VideoJsPlayer) {
4427
},
4528
],
4629
}"
47-
@mounted="onPlayerReady"
4830
/>
4931
</template>

app/plugins/videojs-player.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import VueVideoPlayer from '@videojs-player/vue';
2+
import 'video.js/dist/video-js.css';
3+
4+
export default defineNuxtPlugin((nuxtApp) => {
5+
nuxtApp.vueApp.use(VueVideoPlayer);
6+
});

0 commit comments

Comments
 (0)