Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
V

videojs-player

> 前端框架
Open source

@videojs player component for @vuejs(3) and React.

5.4K stars0 likes2 views
WebsiteGitHub

About

@videojs player component for @vuejs(3) and React.


videojs-player

            Video.js player component for Vue(3) and React.


BREAKING CHANGE ⚠️

The vue-video-player package has now been renamed to @videojs-player/vue due to the addition of support for React. Also, support for Vue has undergone a Breaking change, with the latest version of the component only supporting Vue3.

The last version of the vue-video-player package will be released in v6.0, which will just re-export everything from @videojs-player/vue, so if you're ready to use the new version of vue-video-player, please import @videojs-player/vue directly.

The latest version of videojs-player supports responsiveness for the vast majority of Video.js configuration options and allows you to fully customize the player's control panel and interaction details, thanks to the fact that the component does enough processing internally for different frameworks.

Legacy Version

If you are looking for a legacy version of the component for Vue2, use the [email protected]


Component Documentation

  • Examples
  • Usage in Vue
  • Usage in React
  • Component Props
  • Component Events
  • Player State

Video.js Documentation

  • Video.js Guides
  • Video.js API Documentation
  • Video.js Options Reference
  • Video.js Plugins and Skins

Usage (Vue)

Install

bash
npm install video.js @videojs-player/vue --save
bash
yarn add video.js @videojs-player/vue

Global component

javascript
import { createApp } from 'vue'
import VueVideoPlayer from '@videojs-player/vue'
import 'video.js/dist/video-js.css'

const app = createApp()

app.use(VueVideoPlayer)

Local component

xml
<template>
  <video-player
    src="/your-path/video.mp4"
    poster="/your-path/poster.jpg"
    controls
    :loop="true"
    :volume="0.6"
    ...
    @mounted="..."
    @ready="..."
    @play="..."
    @pause="..."
    @ended="..."
    @seeking="..."
    ...
  />
</template>

<script>
  import { defineComponent } from 'vue'
  import { VideoPlayer } from '@videojs-player/vue'
  import 'video.js/dist/video-js.css'

  export default defineComponent({
    components: {
      VideoPlayer
    }
  })
</script>

Custom player controls

xml
<template>
  <video-player :children="[]" ...>
    <template v-slot="{ player, state }">
      

    </template>
  </video-player>
</template>

Usage (React)

Install

bash
npm install video.js @videojs-player/react --save
bash
yarn add video.js @videojs-player/react

Component

typescript
import React from 'react'
import { VideoPlayer } from '@videojs-player/react'
import 'video.js/dist/video-js.css'

export const Component: React.FC = () => {
  return (
    <VideoPlayer
      src="/your-path/video.mp4"
      poster="/your-path/poster.jpg"
      controls
      loop={true}
      volume={0.6}
      // more props...
      onMounted={/*...*/}
      onReady={/*...*/}
      onPlay={/*...*/}
      onPause={/*...*/}
      onEnded={/*...*/}
      onSeeking={/*...*/}
      // more events...
    />
  )
}

Custom player controls

typescript
import React from 'react'
import { VideoPlayer } from '@videojs-player/react'

export const Component: React.FC = () => {
  return (
    <VideoPlayer videoJsChildren={[]} /* props... */>
      {({ player, state }) => (
        

      )}
    </VideoPlayer>
  )
}

Component Props

All parameters are optional and Video.js determines the default value of each prop.

"responsive" means that if the prop value you pass in the component changes, Video.js will automatically respond to the corresponding update, e.g. a change in volume will cause the player to change the volume.

Prop Name Video.js API Doc & Description Type Responsive
id options.id String
src options.src String ✓
sources options.sources Array ✓
width options.width Number ✓
height options.height Number ✓
preload options.preload String ✓
loop options.loop Boolean ✓
muted options.muted Boolean ✓
poster options.poster String ✓
controls options.controls Boolean ✓
autoplay options.autoplay Boolean | String ✓
playsinline options.playsinline Boolean ✓
crossorigin options.crossOrigin String ✓
volume A number, between 0 and 1, control the volume of the player. Number ✓
playbackRate Control the playback rate of the player. Number ✓
playbackRates options.playbackRates Array<Number> ✓
fluid options.fluid Boolean ✓
fill options.fill Boolean ✓
language options.language String ✓
languages options.languages Object
tracks options.tracks Array ✓
textTrackSettings options.textTrackSettings Object ✓
responsive options.responsive Boolean ✓
breakpoints options.breakpoints Object ✓
fullscreen options.fullscreen FullscreenOptions
aspectRatio options.aspectRatio Boolean ✓
liveui options.liveui Boolean
liveTracker options.liveTracker Object
disablePictureInPicture options.disablePictureInPicture Boolean ✓
notSupportedMessage options.notSupportedMessage String ✓
normalizeAutoplay options.normalizeAutoplay Boolean ✓
audioPosterMode options.audioPosterMode Boolean ✓
audioOnlyMode options.audioOnlyMode Boolean ✓
noUITitleAttributes options.noUITitleAttributes Boolean
preferFullWindow options.preferFullWindow Boolean
suppressNotSupportedError options.suppressNotSupportedError Boolean
techCanOverridePoster options.techCanOverridePoster Boolean
techOrder options.techOrder Array
inactivityTimeout options.inactivityTimeout

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

TypeScriptdash-playerflv-playerhls-playerplayer

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category前端框架
PricingOpen source

> Related tools

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架