This is a Plugin For VideoJS 8+ To select Quality on the Video if available
This is a complete FORK by https://github.com/chrisboustead from https://github.com/chrisboustead/videojs-hls-quality-selector
Changelog
videojs-contrib-quality-levels ^4
npm i videojs-contrib-quality-levels
npm install --save videojs-quality-selector-hls
To include videojs-quality-selector-hls on your website or web application, use any of the following methods.
<script>
TagThis is the simplest case. Get the script in whatever way you prefer and include the plugin after you include video.js, so that the videojs
global is available.
<script src="https://github.com/tomexsans/videojs-quality-selector-hls/raw/main//path/to/video.min.js"></script>
<script src="https://github.com/tomexsans/videojs-quality-selector-hls/raw/main//path/to/videojs-quality-selector-hls.min.js"></script>
<script>
var player = videojs('my-video');
player.qualitySelectorHls();
</script>
When using with Browserify, install videojs-quality-selector-hls via npm and require
the plugin as you would any other module.
var videojs = require('video.js');
// The actual plugin function is exported by this module, but it is also
// attached to the `Player.prototype`; so, there is no need to assign it
// to a variable.
require('videojs-quality-selector-hls');
var player = videojs('my-video');
player.qualitySelectorHls();
When using with RequireJS (or another AMD library), get the script in whatever way you prefer and require
the plugin as you normally would:
require(['video.js', 'videojs-quality-selector-hls'], function(videojs) {
var player = videojs('my-video');
player.qualitySelectorHls();
});
<script setup>
import 'video.js/dist/video-js.css'
import { ref,onMounted } from 'vue';
import videojs from 'video.js';
import 'videojs-contrib-quality-levels';
import qualitySelectorHls from 'videojs-quality-selector-hls'
const videoPlayer = ref(null)
onMounted(()=>{
// In case an error where qualitySelectorHls not found
videojs.registerPlugin('qualitySelectorHls',qualitySelectorHls);
const player = videojs(videoPlayer.value)
player.qualitySelectorHls()
})
</script>
boolean
- falseSet to true to display the currently selected resolution in the menu button. When not enabled, displayed an included VJS "HD" icon.
integer
Set this to override the default positioning of the menu button in the control bar relative to the other components in the control bar.
string
- "vjs-icon-hd"Set this to one of the custom VJS icons (https://videojs.github.io/font/) to override the icon for the menu button.
var player = videojs('my-video');
player.qualitySelectorHls({
displayCurrentQuality: true,
placementIndex: 2,
vjsIconClass: 'vjs-icon-hd'
});
MIT. Copyright (c) Tomexsans Evaristo <t2t.exe@gmail.com>