File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22// Import the Vue wrapper
33import { 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-
105interface Props {
116 src: string ;
127 poster? : string ;
138}
14-
159const 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 >
Original file line number Diff line number Diff line change 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+ } ) ;
You can’t perform that action at this time.
0 commit comments