Socket
Socket
Sign inDemoInstall

videojs-contrib-quality-levels

Package Overview
Dependencies
Maintainers
22
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

videojs-contrib-quality-levels

Exposes a list of quality levels available for the source.


Version published
Weekly downloads
231K
increased by3.17%
Maintainers
22
Weekly downloads
 
Created

What is videojs-contrib-quality-levels?

The videojs-contrib-quality-levels package is a plugin for Video.js that provides an API for managing and interacting with the quality levels of a video. This is particularly useful for adaptive bitrate streaming, where multiple quality levels are available, and you want to control or monitor which quality level is being used.

What are videojs-contrib-quality-levels's main functionalities?

Get Available Quality Levels

This feature allows you to get all available quality levels for the video. The 'addqualitylevel' event is triggered whenever a new quality level is added, and you can access the quality level object from the event.

const player = videojs('my-video');
player.qualityLevels().on('addqualitylevel', function(event) {
  const qualityLevel = event.qualityLevel;
  console.log('Quality level added:', qualityLevel);
});

Select a Quality Level

This feature allows you to select a specific quality level based on certain criteria, such as resolution. In this example, the code selects the 720p quality level and disables all others.

const player = videojs('my-video');
const qualityLevels = player.qualityLevels();
qualityLevels.on('addqualitylevel', function(event) {
  const qualityLevel = event.qualityLevel;
  if (qualityLevel.height === 720) { // Select 720p quality level
    qualityLevel.enabled = true;
  } else {
    qualityLevel.enabled = false;
  }
});

Monitor Quality Level Changes

This feature allows you to monitor changes in the active quality level. The 'change' event is triggered whenever the active quality level changes, and you can access the new active quality level from the qualityLevels array.

const player = videojs('my-video');
const qualityLevels = player.qualityLevels();
qualityLevels.on('change', function() {
  const activeQualityLevel = qualityLevels[qualityLevels.selectedIndex];
  console.log('Active quality level changed to:', activeQualityLevel);
});

Other packages similar to videojs-contrib-quality-levels

Keywords

FAQs

Package last updated on 06 Mar 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc