Is there a way to add audio select button in controls of react-player along with captions select button?

17 Views Asked by At

I have a video that I'm currently playing on ReactPlayer.

I am also able to show different captions and select different captions.

I am trying to see if I can select the audio for the video just like I can select the required caption from video controls

const [audioTracks, setAudioTracks] = useState([]);
...
// populating the audioTracks array
...
// passing this in the ReactPlayer config (from chatgpt)
config={{
  file: {
    attributes: {
      crossOrigin: "true",
    },
    tracks: [...subtitleTracks, ...audioTracks],
    },
}}

// where eack item in audioTrack is in the form 

const newTrack = {
  kind: "audio",
  src: audioUrl,
  srcLang: "English",
  label: "English",
  default: false,
};

I am able to see different captions and also select the required one but I am unable to see the option to select the audio.

Is it possible?

0

There are 0 best solutions below