Vue Video.js Player

6.0.0 · renamed · verified Tue Apr 21

vue-video-player is a package that provides a Vue component for integrating the Video.js player into applications. Version 6.0.0 is the final release under this specific package name and functions primarily as a re-export of the newly named `@videojs-player/vue` package. The project has undergone a significant architectural change, now offering distinct packages for Vue and React (with `@videojs-player/react`). The current stable version for Vue 3 is `@videojs-player/vue@1.x`. This library exclusively supports Vue 3, with Vue 2 support remaining in the legacy `vue-video-player@4.x` branch. It differentiates itself by offering responsive design, extensive customization options for the control panel, and internal processing designed to abstract framework-specific complexities, aiming for a robust and flexible video integration solution.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to import and use the VideoPlayer component from `@videojs-player/vue` in a Vue 3 setup script. It includes necessary CSS imports and sets up basic player options for a responsive video.

<template>
  <div class="video-container">
    <h1>My Custom Video Player</h1>
    <VideoPlayer :options="playerOptions" />
  </div>
</template>

<script setup lang="ts">
import { reactive } from 'vue';
import { VideoPlayer } from '@videojs-player/vue';
import 'video.js/dist/video-js.css'; // Core Video.js CSS
import '@videojs-player/vue/dist/index.css'; // Component-specific CSS

// Basic player options (customize as needed)
const playerOptions = reactive({
  autoplay: true,
  controls: true,
  responsive: true,
  fluid: true, // Scales the player to fill the width of the container
  sources: [
    {
      src: 'https://cdn.plyr.io/static/demo/earth.mp4',
      type: 'video/mp4',
    },
  ],
  // You can add more Video.js options here, e.g., poster, language, etc.
  // Example: poster: 'your-poster-image.jpg'
});
</script>

<style scoped>
.video-container {
  max-width: 900px; /* Example: Constrain player width */
  margin: 20px auto;
  background-color: #f0f0f0;
  padding: 10px;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
h1 {
  text-align: center;
  color: #333;
  margin-bottom: 20px;
}
</style>

view raw JSON →