The following is my code: I need to add a quality selector in a webpage which uses videojs. I am not sure on how to use the plugins, there weren't any examples of plugins in React. The way I inserted the plugins don't work. Please help
Videojs
<script src="https://vjs.zencdn.net/7.6.6/video.js"></script>
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
<script src="https://vjs.zencdn.net/ie8/1.1.2/videojs-ie8.min.js"></script>
<script src="https://cdn.streamroot.io/videojs-hlsjs-plugin/1/stable/videojs-hlsjs-plugin.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/videojs-overlay/1.1.4/videojs-overlay.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Poppins&display=swap" rel="stylesheet">
<script src="../dist/silvermine-videojs-chromecast.min.js<?php echo "?".$version; ?>"></script>
<div class="col-sm-6">
<div class="video-player1">
<video autoplay id="example-video" class="video-js vjs-theme-fantasy custom-videojs" controls>
</video>
<script>
var options = {
html5: {
hlsjsConfig: {
// Put your hls.js config here
}
},
controls: true,
techOrder: [ 'chromecast', 'html5' ], // You may have more Tech, such as Flash or HLS
plugins: {
chromecast: {}
}
};
// setup beforeinitialize hook
videojs.Html5Hlsjs.addHook('beforeinitialize', (videojsPlayer, hlsjsInstance) => {
// here you can interact with hls.js instance and/or video.js playback is initialized
});
var player = videojs('example-video', options, function() {});
var overlay_content = '<div class="overlay_title"><div class="wrapper"><img src="images/nologo.jpg" align="middle" class="logoVideo" id="logovideo"> <div style="padding-left:10px"><h2 id="channeltitle" style="font-size: 22px;" ></h2><h4 id="descrtitle" style="font-size: 17px;"></h4></div></div><div id="progressp" class="progress-bar"><div id="progress_channel" class="progress"></div></div>';
player.overlay({
overlays: [{
start: 'useractive',
content: overlay_content,
end: 'userinactive',
align: 'bottom'
}]
});
function play(url) {
player.pause();
player.src({
src: url,
type: 'application/x-mpegURL'
});
player.load();
player.play();
// here you can interact with hls.js instance and/or video.js playback is initialized
}
</script>