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.

There is also an example of player integration for an old Vue 2


19.11.2
2024 © PlayerJS

Sign up

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

Restore password

Restore
Forgot email? Contact us