Vue.js


Example of a simple Vue3 application that creates a player in the player container

App.vue

<template>
  <div id="player"></div>
</template>

<script>
import { ref } from 'vue';
import pjs from './playerjsloader.js';

export default {
   name: 'Test',
   setup() {
      pjs.then(() => {
         let player = new Playerjs({
            id: 'player',
            file: 'https://plrjs.com/sample.mp4',
         });
      });
   },
};
</script>

<style>
#player {
   width: 100%;
}
</style>

playerjsloader.js

export default new Promise((res) => {
   const script = document.createElement('script');
   script.onload = () => res();
   script.setAttribute(
      'src',
      'https://mysite.com/playerjs.js'
   );
   document.head.appendChild(script);
});

You need to change the selected links to your own.


19.9.102024 © PlayerJS

Sign up free

Sign up
By signing up, you agree to Terms of Service
Login if you have an account

Restore password

Restore
Forgot email? Contact us