I have managed to load the aws IVS
streaming channel into video tag
. Now I need to display the closed caption feature as well. But it is not displaying any closed captioning
while clicking on the captions button.
function IVSComponent(options) {
const divEl = useRef(null);
const videoEl = useRef(null);
useEffect(() => {
const script = document.createElement('script');
script.src = 'https://player.live-video.net/1.0.0/amazon-ivs-player.min.js';
script.async = true;
document.body.appendChild(script);
script.onload = () => {
if (IVSPlayer.isPlayerSupported) {
const player = IVSPlayer.create();
player.attachHTMLVideoElement(document.getElementById('video-player'));
player.load("https://fcc3ddae59ed.us-west-2.playback.live-video.net/api/video/v1/us-west-2.893648527354.channel.xhP3ExfcX8ON.m3u8");
player.play();
}
}
return () => {
document.body.removeChild(script);
}
},[])
return (
<div ref={divEl}>
<video id="video-player" x-webkit-airplay="allow" ref={videoEl} playsInline autoPlay controls>
<track label="English" kind="subtitles" srclang="en" src="https://video-react.js.org/assets/elephantsdream/captions.en.vtt" default />
<track label="Deutsch" kind="subtitles" srclang="de" src="https://video-react.js.org/assets/elephantsdream/captions.en.vtt" />
<track label="Español" kind="subtitles" srclang="es" src="https://video-react.js.org/assets/elephantsdream/captions.en.vtt"></track>
</video>
</div>
);
}
export default IVSComponent;