videojs / mux.js

Lightweight utilities for inspecting and manipulating video container formats.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to implement with videojs

st-hieucao opened this issue · comments

  • First, i want to thank you for this package, it helped me a lot. I have 1 problem with videojs library, please help me. How to know the type of the video when initializing the player in videojs (Reactjs)
const initPlayer = () => {
    const videoPlayer = videojs(videoRef.current, {
      controls: true,
      muted: true,
      sources: [{
        src: URL.createObjectURL(mediaSource),
        type: 'video/mp4', // type is wrong in videojs
      }],
    });
    playerRef.current = videoPlayer;
  }

<video ref={videoRef}></video>

image