### Install and Require via NPM Source: https://github.com/silvermine/videojs-quality-selector/blob/master/README.md Installs the plugin using npm and then requires both the plugin and its CSS for integration into a project using a module bundler. ```bash npm install --save @silvermine/videojs-quality-selector ``` ```javascript var videojs = require('videojs'); // The following registers the plugin with `videojs` require('@silvermine/videojs-quality-selector')(videojs); require('@silvermine/videojs-quality-selector/dist/css/quality-selector.css') ``` -------------------------------- ### Initialize Video.js Player with Quality Selector Source: https://github.com/silvermine/videojs-quality-selector/blob/master/docs/demo/index.html Initializes a Video.js player and adds the QualitySelector component to its control bar. This allows users to select different video quality levels. ```javascript videojs('video_1', {}, function() { var player = this; player.controlBar.addChild('QualitySelector'); }); ``` -------------------------------- ### Include via Script Tag (Local File) Source: https://github.com/silvermine/videojs-quality-selector/blob/master/README.md Includes the VideoJS library and the quality selector plugin from local files using script tags. Ensure the plugin script is included after the VideoJS script. ```html ``` -------------------------------- ### Include via Script Tag (unpkg CDN) Source: https://github.com/silvermine/videojs-quality-selector/blob/master/README.md Includes the VideoJS quality selector plugin's CSS and JavaScript from the unpkg CDN. This method requires the VideoJS library to be included separately. ```html ``` -------------------------------- ### Provide Sources using player.src() Source: https://github.com/silvermine/videojs-quality-selector/blob/master/README.md Sets multiple video sources programmatically using the player.src() method. Each source object includes the source URL, type, a human-readable label, and an optional 'selected' flag. ```javascript player.src([ { src: 'https://example.com/video_720.mp4', type: 'video/mp4', label: '720P', }, { src: 'https://example.com/video_480.mp4', type: 'video/mp4', label: '480P', selected: true, }, { src: 'https://example.com/video_360.mp4', type: 'video/mp4', label: '360P', }, ]); ``` -------------------------------- ### Provide Sources using tag Source: https://github.com/silvermine/videojs-quality-selector/blob/master/README.md Defines multiple video sources with different quality labels using the HTML5 tag within a video element. The 'selected' attribute can mark a default source. ```html ``` -------------------------------- ### Add Quality Selector via Player Options Source: https://github.com/silvermine/videojs-quality-selector/blob/master/README.md Configures the VideoJS player to include the QualitySelector component in its control bar by specifying it within the 'children' array of the 'controlBar' options during player initialization. ```javascript var options, player; options = { controlBar: { children: [ 'playToggle', 'progressControl', 'volumePanel', 'qualitySelector', 'fullscreenToggle', ], }, }; player = videojs('video_1', options); ``` -------------------------------- ### Add Quality Selector via addChild Source: https://github.com/silvermine/videojs-quality-selector/blob/master/README.md Adds the QualitySelector component to the VideoJS player's control bar after the player has been initialized. This method allows for dynamic addition of controls. ```javascript videojs('video_1', {}, function() { var player = this; player.controlBar.addChild('QualitySelector'); }); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.