Gathering detailed insights and metrics for videojs-contrib-quality-levels
Gathering detailed insights and metrics for videojs-contrib-quality-levels
Gathering detailed insights and metrics for videojs-contrib-quality-levels
Gathering detailed insights and metrics for videojs-contrib-quality-levels
@types/videojs-contrib-quality-levels
TypeScript definitions for videojs-contrib-quality-levels
videojs-http-source-selector
VideoJS plugin that leverages videojs-contrib-quality-levels plugin to offer manual user-selectable level selection options for adaptive http streams.
jb-videojs-hls-quality-selector
Adds a quality selector menu for HLS sources played in videojs. Requires `videojs-contrib-hls` and videojs-contrib-quality-levels plugins.
videojs-http-quality-selector
VideoJS plugin that leverages videojs-contrib-quality-levels plugin to offer manual user-selectable level selection options for adaptive http streams. Based on videojs-http-source-selector
npm install videojs-contrib-quality-levels
79
Supply Chain
96
Quality
83.7
Maintenance
100
Vulnerability
99.6
License
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
157 Stars
72 Commits
51 Forks
29 Watching
2 Branches
22 Contributors
Updated on 16 Nov 2024
Minified
Minified + Gzipped
JavaScript (81.87%)
HTML (17.44%)
Shell (0.69%)
Cumulative downloads
Total Downloads
Last day
-8.2%
45,429
Compared to previous day
Last week
4.2%
250,226
Compared to previous week
Last month
7.4%
1,038,026
Compared to previous month
Last year
1.4%
10,094,626
Compared to previous year
1
1
25
A plugin that provides a framework of working with source quality levels.
Maintenance Status: Stable
1npm install --save videojs-contrib-quality-levels
The npm installation is preferred, but Bower works, too.
1bower install --save videojs-contrib-quality-levels
The list of QualityLevels
can be accessed using qualityLevels()
on the Player object.
With this list, you can:
Example
1let player = videojs('my-video'); 2 3let qualityLevels = player.qualityLevels(); 4 5// disable quality levels with less than 720 horizontal lines of resolution when added 6// to the list. 7qualityLevels.on('addqualitylevel', function(event) { 8 let qualityLevel = event.qualityLevel; 9 10 if (qualityLevel.height >= 720) { 11 qualityLevel.enabled = true; 12 } else { 13 qualityLevel.enabled = false; 14 } 15}); 16 17// example function that will toggle quality levels between SD and HD, defining and HD 18// quality as having 720 horizontal lines of resolution or more 19let toggleQuality = (function() { 20 let enable720 = true; 21 22 return function() { 23 for (let qualityLevel of qualityLevels) { 24 if (qualityLevel.height >= 720) { 25 qualityLevel.enabled = enable720; 26 } else { 27 qualityLevel.enabled = !enable720; 28 } 29 } 30 enable720 = !enable720; 31 }; 32})(); 33 34let currentSelectedQualityLevelIndex = qualityLevels.selectedIndex; // -1 if no level selected 35 36// Listen to change events for when the player selects a new quality level 37qualityLevels.on('change', function() { 38 console.log('Quality Level changed!'); 39 console.log('New level:', qualityLevels[qualityLevels.selectedIndex]); 40});
This project provides the framework for working with source quality levels. Just including this project alongside videojs does not necessarily mean that there will be levels available in the list or that any events will be triggered. Some projects within the videojs org supports this project and automatically populates the list and triggers change
events when the selected quality level changes. See the Supported Projects section for a list of these projects.
If you are not using one of the supported projects, but still want to use quality levels with your source, you will have to implement your own plugin that populates the list and triggers change events when selected level changes. Implementing such a plugin is very specific to the source in question, so it is difficult to provide specific examples, but will most likely require a custom middleware, source handler, or tech.
Initially the list of quality levels will be empty. You can add quality levels to the list by using QualityLevelList.addQualityLevel
for each quality level specific to your source. QualityLevelList.addQualityLevel
takes in a Representation
object (or generic object with the required properties). All properties are required except width
, height
and frameRate
.
Example Representation
1Representation { 2 id: string, 3 width: number, 4 height: number, 5 bitrate: number, 6 frameRate: number, 7 enabled: function 8}
The enabled
function should take an optional boolean to enable or disable the representation and return whether it is currently enabled.
You can also remove quality levels from the list using QualityLevelList.removeQualityLevel
. Call this function with the reference to the QualityLevel
object you wish to remove. The QualityLevelList.selectedIndex
property will automatically be updated when a quality level is removed so that it still refers to the correct level. If the currently selected level is removed, the selectedIndex
will be set to -1
.
When your playback plugin changes the selected quality for playback, you will also have to trigger the change
event on the QualityLevelList
and update the QualityLevelList.selectedIndex_
, as it does not have knowledge of which quality is active in playback.
1let player = videojs('my-video'); 2 3let qualityLevels = player.qualityLevels(); 4 5qualityLevels.selectedIndex_ = 0; 6qualityLevels.trigger({ type: 'change', selectedIndex: 0 });
The following projects have built-in support for videojs-contrib-quality-levels and will automatically populate the list with available levels and trigger change
events when the quality level changes.
To include videojs-contrib-quality-levels 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.
1<script src="//path/to/video.min.js"></script> 2<script src="//path/to/videojs-contrib-quality-levels.min.js"></script> 3<script> 4 var player = videojs('my-video'); 5 6 player.qualityLevels(); 7</script>
When using with Browserify, install videojs-contrib-quality-levels via npm and require
the plugin as you would any other module.
1var videojs = require('video.js'); 2 3// The actual plugin function is exported by this module, but it is also 4// attached to the `Player.prototype`; so, there is no need to assign it 5// to a variable. 6require('videojs-contrib-quality-levels'); 7 8var player = videojs('my-video'); 9 10player.qualityLevels();
When using with RequireJS (or another AMD library), get the script in whatever way you prefer and require
the plugin as you normally would:
1require(['video.js', 'videojs-contrib-quality-levels'], function(videojs) { 2 var player = videojs('my-video'); 3 4 player.qualityLevels(); 5});
Apache-2.0. Copyright (c) Brightcove, Inc.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 17/26 approved changesets -- score normalized to 6
Reason
0 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
20 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More