Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@silvermine/videojs-quality-selector
Advanced tools
video.js plugin for selecting a video quality or resolution
A plugin for videojs versions 6+ that adds a button to the control bar which will allow the user to choose from available video qualities or resolutions.
There are three primary steps to use this plug-in: (1) including,
(2) providing sources, and (3) adding the component the to
controlBar
. Please see the following for information on each
step.
<script>
tagThe minified JS file can come from a downloaded copy or a CDN. When including
it, make sure that the <script>
tag for the plugin appears after the
include for video.js (note that this plugin will look
for videojs
at window.videojs
).
There is an example of this in
docs/demo/index.html
.
<script src="./path/to/video.min.js"></script>
<script src="./path/to/silvermine-videojs-quality-selector.min.js"></script>
unpkg
<link href="https://unpkg.com/@silvermine/videojs-quality-selector/dist/css/quality-selector.css" rel="stylesheet">
<script src="./path/to/video.min.js"></script>
<script src="https://unpkg.com/@silvermine/videojs-quality-selector/dist/js/silvermine-videojs-quality-selector.min.js"></script>
require
When using NPM/Browserify, first install the plugin.
npm install --save @silvermine/videojs-quality-selector
For videojs
to use the plug-in, the plugin needs to register itself with the instance of
videojs
. This can be accomplished by:
var videojs = require('videojs');
// The following registers the plugin with `videojs`
require('@silvermine/videojs-quality-selector')(videojs);
Remember to also add the CSS to your build. With most bundlers you can:
require('@silvermine/videojs-quality-selector/dist/css/quality-selector.css')
[!WARNING] This plugin's source code uses ES6+ syntax and keywords, such as
class
andstatic
. If you need to support browsers that do not support newer JavaScript syntax, you will need to use a tool like Babel to transpile and polyfill your code.Alternatively, you can
require('@silvermine/videojs-quality-selector/dist/js/silvermine-videojs-quality-selector.js')
to use a JavaScript file that has already been polyfilled/transpiled down to ES5 compatibility.
Sources can be provided with either the <source>
tag or via the src
function on the
instance of a video.js
player.
<source>
<video id="video_1" class="video-js vjs-default-skin" controls preload="auto" width="640" height="268">
<source src="https://example.com/video_720.mp4" type="video/mp4" label="720P">
<source src="https://example.com/video_480.mp4" type="video/mp4" label="480P" selected="true">
<source src="https://example.com/video_360.mp4" type="video/mp4" label="360P">
</video>
player.src()
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',
},
]);
There are at least two ways to add the quality selector control to the player's control
bar. The first is directly adding it via addChild
. For example:
videojs('video_1', {}, function() {
var player = this;
player.controlBar.addChild('QualitySelector');
});
The second option is to add the control via the player's options, for instance:
var options, player;
options = {
controlBar: {
children: [
'playToggle',
'progressControl',
'volumePanel',
'qualitySelector',
'fullscreenToggle',
],
},
};
player = videojs('video_1', options);
We genuinely appreciate external contributions. See our extensive documentation on how to contribute.
This software is released under the MIT license. See the license file for more details.
FAQs
video.js plugin for selecting a video quality or resolution
The npm package @silvermine/videojs-quality-selector receives a total of 4,936 weekly downloads. As such, @silvermine/videojs-quality-selector popularity was classified as popular.
We found that @silvermine/videojs-quality-selector demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.