Coder Social home page Coder Social logo

videojs-contrib-quality-levels's Introduction

videojs-contrib-quality-levels

Build Status Greenkeeper badge Slack Status

NPM

A plugin that provides a framework of working with source quality levels.

Maintenance Status: Stable

Installation

Installation

npm install --save videojs-contrib-quality-levels

The npm installation is preferred, but Bower works, too.

bower install  --save videojs-contrib-quality-levels

Using

The list of QualityLevels can be accessed using qualityLevels() on the Player object. With this list, you can:

  • See which quality levels are available for the current source
  • Enable or disable specific quality levels to change which levels are selected by ABR
  • See which quality level is currently selected by ABR
  • Detect when the selected quality level changes

Example

let player = videojs('my-video');

let qualityLevels = player.qualityLevels();

// disable quality levels with less than 720 horizontal lines of resolution when added
// to the list.
qualityLevels.on('addqualitylevel', function(event) {
  let qualityLevel = event.qualityLevel;

  if (qualityLevel.height >= 720) {
    qualityLevel.enabled = true;
  } else {
    qualityLevel.enabled = false;
  }
});

// example function that will toggle quality levels between SD and HD, defining and HD
// quality as having 720 horizontal lines of resolution or more
let toggleQuality = (function() {
  let enable720 = true;

  return function() {
    for (let qualityLevel of qualityLevels) {
      if (qualityLevel.height >= 720) {
        qualityLevel.enabled = enable720;
      } else {
        qualityLevel.enabled = !enable720;
      }
    }
    enable720 = !enable720;
  };
})();

let currentSelectedQualityLevelIndex = qualityLevels.selectedIndex; // -1 if no level selected

// Listen to change events for when the player selects a new quality level
qualityLevels.on('change', function() {
  console.log('Quality Level changed!');
  console.log('New level:', qualityLevels[qualityLevels.selectedIndex]);
});

Supporting Quality Levels for your source

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.

Populating the list

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

Representation {
  id: string,
  width: number,
  height: number,
  bitrate: number,
  frameRate: number,
  enabled: function
}

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.

Triggering the 'change' event

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.

let player = videojs('my-video');

let qualityLevels = player.qualityLevels();

qualityLevels.selectedIndex_ = 0;
qualityLevels.trigger({ type: 'change', selectedIndex: 0 });

Supported Projects

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.

Including the Plugin

To include videojs-contrib-quality-levels on your website or web application, use any of the following methods.

<script> Tag

This 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="//path/to/video.min.js"></script>
<script src="//path/to/videojs-contrib-quality-levels.min.js"></script>
<script>
  var player = videojs('my-video');

  player.qualityLevels();
</script>

Browserify

When using with Browserify, install videojs-contrib-quality-levels 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-contrib-quality-levels');

var player = videojs('my-video');

player.qualityLevels();

RequireJS/AMD

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-contrib-quality-levels'], function(videojs) {
  var player = videojs('my-video');

  player.qualityLevels();
});

License

Apache-2.0. Copyright (c) Brightcove, Inc.

videojs-contrib-quality-levels's People

Contributors

199911 avatar alex-barstow avatar bcdarius avatar brandonocasey avatar cs-student101 avatar dzianis-dashkevich avatar ejadib avatar forbesjo avatar gesinger avatar gjanblaszczyk avatar gkatsev avatar greenkeeper[bot] avatar imbcmdth avatar jaredjj3 avatar mister-ben avatar misteroneill avatar mjneil avatar philjhale avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

videojs-contrib-quality-levels's Issues

Not working with videojs-contrib-dash

Description

Quality selector is not working when use videojs-contrib-dash .(i m using contrib-dash because of DRM). When i comment out videojs-contrib-dash it is working.

I could not find the reason. maybe it is about videojs-contrib-dash i dont know. Please help me.

plugins

"video.js": "^7.10.2",
"videojs-contrib-quality-levels": "^2.0.9",
"videojs-contrib-dash": "^5.0.0",

No levels available in Safari

Hi. Thank you for awesome plugin. For me it works smoothly in all browsers except Safari (web and mobile). The addqualitylevel is not firing in Safari at all. And even when I check levels after some time there are no levels available.

player.qualityLevels().on('addqualitylevel', function(event) {})

Can you recommend any workaround for it? Here is an example where it doesn't work.

http://jsbin.com/vagelic/edit?js,console,output

Not working for DASH

Description

This plugin has no support for DASH streams.

If there's no intention to add DASH or any other format in this plugin it should be renamed to videojs-contrib-hls-quality-levels for example.

Steps to reproduce

Play this video https://bitdash-a.akamaihd.net/content/sintel/sintel.mpd and try to call player.qualityLevels().

Results

player.qualityLevels() returns an empty list.

Actual

It should return available quality levels.

Error output

None.

Additional Information

versions

videojs

7.0.5

browsers

All

OSes

All

plugins

dash-contrib

strange transitions

hi
so I update to the last videojs, last video-contrib-hls, and your script.

I have been streaming a 2 resolution level playlist and since I have a rather bad internet, I just put some download file and youtube at the same time, to see that the script catch the lowest res when my internet is low. which is what is expected, so that's great. It also catch back the highest res when my bandwidth get better (ie stopping youtube).

My issue is more about the transition, when it takes the lowest, it download a segment that was previously downloaded on the other resolution and eventually starts to downloads segments twice of the same resolution

https://i.gyazo.com/9397b320708d2fa93057e57b68dbb9cf.png

edit: i made sure that my 2 playlist (from the master playlist) had similar numbered segment at the same time, that could have explained the problem.

When clicking on a quality from the dropdown, nothing is happening

Description

When I click on the quality such as 360, 720 or 1080, nothing is happening, there is no change of the quality.
I can see the below warning in the console:

instrument.js?ea14:109 VIDEOJS: WARN: We received no playlist to switch to. Please check your stream.

When testing my below m3u8 file, it seems correct:

#EXTM3U
#EXT-X-VERSION:4
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",LANGUAGE="fr",NAME="Default",DEFAULT=YES,AUTOSELECT=YES,URI="audio/audio1.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="Audio-only",LANGUAGE="fr",NAME="Podcast",DEFAULT=NO,AUTOSELECT=NO,URI="audio/audio1.m3u8"
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=230000,NAME="360p",CODECS="avc1.42001e",RESOLUTION=640x360,AUDIO="aac"
360p/360p.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=600000,NAME="480p",CODECS="avc1.42001e",RESOLUTION=854x480,AUDIO="aac"
480p/480p.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=2500000,NAME="720p",CODECS="avc1.4d0028",RESOLUTION=1280x720,AUDIO="aac"
720p/720p.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=3500000,NAME="1080p",CODECS="avc1.640029",RESOLUTION=1920x1080,AUDIO="aac"
1080p/1080p.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=128000,NAME="Audio",CODECS="mp4a.40.2",AUDIO="Audio-only"
audio/audio1.m3u8

Videojs is configured as below:

import videojs from 'video.js';
import 'videojs-contrib-quality-levels';
import videojsqualityselector from 'videojs-hls-quality-selector';

  const options = {
    fill: true,
    fluid: true,
    preload: 'auto',
    html5: {
        vhs: {
        enableLowInitialPlaylist: true,
        smoothQualityChange: true,
        overrideNative: true,
        useDevicePixelRatio: true,
      },
    },
  };

 const vjsPlayer = videojs(videoRef.current, {
      ...options,
      controls,
      autoplay,
      sources: [src]
    });
    vjsPlayer.hlsQualitySelector = videojsqualityselector;
    vjsPlayer.hlsQualitySelector({
        displayCurrentQuality: true,
    });

Is there anything i am doing wrong?

When i remove the AUDIO="aac" it is working. It is also working if I remove the 2 #EXT-X-MEDIA lines. But in both cases there is no more sound.

Create react app build ERROS

Guys, good afternoon.
There was a problem with the assembly of the project. That's kind of. We use
'create react app'

"video.js": "^7.0.5",
"videojs-contrib-hls": "5.13.0",
"videojs-contrib-quality-levels": "^2.0.5",

2018-07-09 18 05 58

Maybe you know the reasons?

Standalone Version

Hello,

I am using Video.js 5.19.2 with HLS plugin.

Is there any standalone version of your plugin? I dont have nodejs.

The simplest of questions: how do you change the quality?

Description

I can't for the life of me find any info on how to actually change the quality. The following part from your documentation makes me think this is outside the scope of this plugin?!

When your playback plugin changes the selected quality for playback...

Now, your documentation also says we need videojs/http-streaming and they write:

See the videojs-contrib-quality-levels project page for more information on how to use the api.

So, which is it now? Does this plugin provide an API or does videojs itself?

Steps

I'm using this snippet from your page:

qualityLevels.selectedIndex_ = 0;
qualityLevels.trigger({ type: 'change', selectedIndex: 0 });

But this does nothing. Apparently, it's really just there to "update the QualityLevelList.selectedIndex_" - for whatever reason I would want to / have to do that myself.

If I am misunderstanding the README, there seem to be others. Maybe the documentation is just not clear?

cdnjs and dist folder

hello,

I do not use npm or bower.

Could you please submit the resulting file to cdnjs and also create dist folder in github containing resulting videojs-contrib-quality-levels.js file?

If you will not, could you please explain why? Thanks!

TypeError: Cannot read properties of undefined (reading 'merge')

Description

How to fix this error undefined merge after I install and import this package on my videojs project ?

Steps to reproduce

Explain in detail the exact steps necessary to reproduce the issue.

  1. Install package videojs-contrib-quality-levels
  2. Import on component witch import videojs
  3. And then an error will appear

Results

Expected

Want to show quality selector

Actual

TypeError: Cannot read properties of undefined (reading 'merge')

Error output

Unhandled Runtime Error
TypeError: Cannot read properties of undefined (reading 'merge')

Call Stack
Player.qualityLevels
node_modules/videojs-contrib-quality-levels/dist/videojs-contrib-quality-levels.js (303:0)
Player.basicPluginWrapper [as qualityLevels]
node_modules/video.js/dist/video.es.js (27331:0)
VhsHandler.setupQualityLevels_
node_modules/video.js/dist/video.es.js (54516:0)
VhsHandler.src
node_modules/video.js/dist/video.es.js (54410:0)
Object.handleSource
node_modules/video.js/dist/video.es.js (54697:0)
Tech.setSource
node_modules/video.js/dist/video.es.js (9828:0)
new Html5
node_modules/video.js/dist/video.es.js (19853:0)
Player.loadTech

node_modules/video.js/dist/video.es.js (23020:0)
Player.src_
node_modules/video.js/dist/video.es.js (25460:0)

versions

videojs

"video.js": "^7.18.1",
"videojs-contrib-quality-levels": "^4.0.0",

browsers

All browser show error

OSes

All affected

Quality Levels Not Populated in Safari for Playlist with multiple formats

Description

When using native HLS in Safari, the qualityLevels() collection never gets populated. Doing some debugging, it appears that a lot of the internal methods that populate this collection never gets called.

Disabling native hls allows the qualityLevels to get populated

html5: {
	vhs: {
		overrideNative: true,
	},
	nativeAudioTracks: false,
	nativeVideoTracks: false,
},

Steps to reproduce

Explain in detail the exact steps necessary to reproduce the issue.

  1. Load a player with the videojs-contrib-quality-levels plugin enabled and an adaptive streaming playlist set as the source
  2. Check the player's .qualityLevels() property, it will be empty.

Results

Expected

The qualityLevels() should return an array of the different Representations.

Actual

qualityLevels() returns an empty array.

versions

videojs

7.11.8

browsers

Safari

OSes

MacOS

plugins

videojs-contrib-quality-levels v2.1.0

Editing quality list

Description

m3u8 playlist only has BANDWIDTH with not WIDTH or HEIGHT, the output is undefined.

Question

How to handle QualityList based on bitrate? any way to edit the quality list without creating a new one?

Update video js dependency

I am using webpack with video js 6
When I import 'videojs-contrib-quality-levels', both video js 5 and 6 is loaded into webpack

Will this package be updated to version 3.0.0 which depends on video js 6?

Thanks a lot!

An in-range update of pkg-ok is breaking the build 🚨

The devDependency pkg-ok was updated from 2.3.0 to 2.3.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

pkg-ok is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Commits

The new version differs by 6 commits.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

can not work with video.js 5.20.1 videojs-contrib-hls * @version 5.8.1

Hello,

I try to use it

`

<script src="https://cdnjs.cloudflare.com/ajax/libs/video.js/5.20.1/alt/video.novtt.js"></script> <script src="https://unpkg.com/[email protected]/dist/videojs-contrib-quality-levels.js"></script> <script src="https://unpkg.com/videojs-contrib-hls/dist/videojs-contrib-hls.js"></script> <script src="https://players.brightcove.net/videojs-thumbnails/videojs.thumbnails.js"></script>

<source src="https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8" type="application/x-mpegURL">
<script> var player = videojs('video'); player.qualityLevels(); </script>`

Problem in IE10

hi
qualityLevels not auto hls list in internet explorer 10!!!

player.ready(function() {
    var ql = this.qualityLevels();
    this.src({
      src: 'data/t2/input2/playlist.m3u8',
      type: 'application/x-mpegURL'
    });
    this.on('loadedmetadata', () => {
        console.log(ql.length) // 0
    });
});

Dependency Injection

This is the exact same issue that I had with videojs-contrib-ads. For details, see: videojs/videojs-contrib-ads#480

Description

When multiple instances of VideoJS exist, there is no way to specify which instance videojs-contrib-quality-levels should bind to. Worse yet, it creates its own personal instance of VideoJS when included as a submodule in a project

Steps to reproduce

Explain in detail the exact steps necessary to reproduce the issue.

  1. Create a new project
  2. npm install --save video.js videojs-contrib-quality-levels
  3. In your entrypoint: const videojs = require("video.js/core") and require("videojs-contrib-quality-levels")
  4. Attempt to initialize the qualityLevels plugin: videojs("myPlayer", { plugins: { qualityLevels: {} } });

Results

Expected

The player initializes properly

Actual

Plugin qualityLevels is not found

Error output

Error: plugin "qualityLevels" does not exist core.js:20125
    Player core.js:20125
    forEach (index):262
    Player core.js:20121
    videojs$1 core.js:24803
    js index.js:4
    Webpack 3
    
    __webpack_require__
    
    <anonymous>
    
    <anonymous>

Additional Information

Please include any additional information necessary here. Including the following:

versions

videojs

v7.4.1

browsers

All

OSes

All

plugins

None

quality levels doesn't work on edge

Hi,

i am using this plugin with videojs-contrib-hls and videojs-hls-source-selector it is working fine on chrome and firefox but it is not working on edge and chrome on mobile this plugin doesn't return any data. i am using videojs 6.2.6

thank you

Frequently changed quality proving error

I have added quality level plugin with custom UI. when I am changing quality frequently then getting error.

Can not read property 'playlist' undefined in 3800 line of hls plugin.

error

m3u8 can not get .m4a , audio only streaming level

Hi,

can not get last file info , it's audio only , m4a streaming.
Thank you.

#EXTM3U

#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1200000,RESOLUTION=854x480

/video/sample_1200k.mp4.m3u8

#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=150000,RESOLUTION=320x180

/video/sample_150k.mp4.m3u8

#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=2000000,RESOLUTION=1280x720

/video/sample_2000k.mp4.m3u8

#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=128000,CODECS="mp4a.40.2"

/audio/sample.m4a.m3u8

Auto Quality Change Example

Hi all!

I've created an multi-bitrate HLS master stream. I've been able to use videojs-contrib-quality-levels to create a "switcher" in the UI to select the stream quality (thanks to this kind user, who actually provided a working example where the documentation doesn't) - but it doesn't seem to contain the functionality to automatically adapt based on available bandwidth - which is the whole point of HLS/DASH.

Is this functionality provided anywhere in the video.js stack, and if so can you point me to an example, or am I expected to roll my own bandwidth adaption?

Thanks!

Has no quality level / can't select qualities despite overrideNative in Safari desktop

Description

In Safari (desktop), the array (qualityLevels()) is empty and thus I cant switch between qualities, even with this options:

const videoJsOptions = {
    autoplay: false,
    preload: "auto",
    controls: true,
    poster: thumbnailURL,
    sources: [
        {
            src: liveURL,
            type: "application/x-mpegURL",
            withCredentials: false,
        },
    ],
    html5: {
        nativeAudioTracks: false,
        nativeVideoTracks: false,
        hls: {
            overrideNative: true,
        },
    },
};

This works well for this person's project (not react though): https://jsfiddle.net/geukvmhn/ -> Check it out in Safari, the qualities are shown.

But it doesn't work at all for me. Basically, I am struggling to override the native HLS engine in Safari (desktop) - more specifically I am struggling to find what are the correct options to override the native HLS engine in Safari.

Here's the full component code

import React, { useRef, useState, useEffect } from "react";
import videojs from "video.js";
import _ from "videojs-contrib-quality-levels";

// those imports are important
import qualitySelector from "videojs-hls-quality-selector";

const VideoPlayerHLS = ({ liveURL, videoId, finishesVideo, thumbnailURL }) => {
	const videoRef = useRef();
	const [player, setPlayer] = useState(undefined);
	const [callFinishVideoAPI, setCallFinishVideoAPI] = useState(false);
	const [vidDuration, setVidDuration] = useState(50000);

	useEffect(() => {
		if (player) {
			player.src({
				src: liveURL,
				type: "application/x-mpegURL",
				withCredentials: false,
			});
			player.poster(thumbnailURL);
			setCallFinishVideoAPI(false);
			setVidDuration(50000);
		}
		// eslint-disable-next-line react-hooks/exhaustive-deps
	}, [videoId, liveURL, thumbnailURL]);

	useEffect(() => {
		if (callFinishVideoAPI) {
			finishesVideo();
		}
		// eslint-disable-next-line react-hooks/exhaustive-deps
	}, [callFinishVideoAPI]);

	useEffect(() => {
		const videoJsOptions = {
			autoplay: false,
			preload: "auto",
			controls: true,
			poster: thumbnailURL,
			sources: [
				{
					src: liveURL,
					type: "application/x-mpegURL",
					withCredentials: false,
				},
			],
			html5: {
				hls: {
					overrideNative: true,
				},
				nativeAudioTracks: false,
				nativeVideoTracks: false,
			},
		};

		const p = videojs(
			videoRef.current,
			videoJsOptions,
			function onPlayerReady() {
				// console.log('onPlayerReady');
			}
		);

		console.log(p.qualityLevels());
		setPlayer(p);
		return () => {
			if (player) player.dispose();
		};
		// eslint-disable-next-line react-hooks/exhaustive-deps
	}, []);

	useEffect(() => {
		if (player) player.hlsQualitySelector({ displayCurrentQuality: true });
	}, [player]);
	return (
		<div data-vjs-player>
			<video
				ref={videoRef}
				onLoadedMetadata={(e, px) => {
					// console.log(e.target.duration);
					setVidDuration(e.target.duration);
				}}
				onTimeUpdate={(e) => {
					if (e.target.currentTime >= vidDuration - 10) {
						setCallFinishVideoAPI(true);
					}
				}}
				className="vidPlayer video-js vjs-default-skin vjs-big-play-centered"
			></video>
		</div>
	);
};

export default VideoPlayerHLS;

Thanks.

qualityLevels with length 0

Description

I've found that issue #13 described a similar problem, and the reply told to use eventListener to addqualitylevel.
I followed, but it seems like it just didn't get to those lines.

my codes are like:

  qualityLevels.on('addqualitylevel', function(event) {
    let qualityLevel = event.qualityLevel;
    console.log('qualityLevel.height:', qualityLevel.height);  // logs not printed
  });

What's more weird is, this problem doesn't always happen.

Users seldom encounter.
And I can only tell that when my document is hidden during the initializing of the player, there's a lot more chance to happen!

Results

Expected

I could get all the tracks(sources) of my video via player.qualityLevels().

Actual

Problems that addqualitylevel seldom not works. player.qualityLevels() is an empty list.

Error output

no error message displayed at all...

Additional Information

versions

videojs

7.5.0+

browsers

desktop chrome, safari

plugins

  • videojs-ima (1.5.1)
  • videojs-contrib-ads (6.6.2)
  • videojs-contrib-quality-levels (2.0.9)

quality selection

hi

sorry if I misunderstand. I have inserted the javascript file as well as the javascript inline code and I don't see any quality list on the player.

Am I missing something?

videojs-contrib-quality-levels plugin doesn't work on Android Chrome and iOS mobile Safari!

Hey there,

I'm using the videojs-contrib-quality-levels plugin in order to have a quality button.
However, my code works on desktop but not on mobile for both Android Chrome and iOS Safari where the quality button isn't even visible.

Check it out, please.

<script src="js/jquery-2.1.4.min.js"></script>
 <script src="js/video.js"></script>
 <script src="js/videojs-contrib-hls.js"></script>
 <script src="js/videojs-contrib-quality-levels.min.js"></script>
<script>
   var options = {
   	inactivityTimeout:0,
   	controls:true,
   	autoplay:true,
   	preload:"auto",
   };
   
   var player = videojs('my_video', options);
   player.src({
     src: 'http://www.streambox.fr/playlists/test_001/stream.m3u8',
     type: 'application/x-mpegURL'
   });
   
   var qLevels = [];

   player.qualityLevels().on('addqualitylevel', function(event) {
   	var quality = event.qualityLevel;
   	console.log(quality);
   	
   	if (quality.height != undefined && $.inArray(quality.height, qLevels) === -1)
   	{
   		quality.enabled = true;
   		
   		qLevels.push(quality.height);
   		
   		if (!$('.quality_ul').length)
   		{
   			var h = '<div class="quality_setting vjs-menu-button vjs-menu-button-popup vjs-control vjs-button">' + '<button class="vjs-menu-button vjs-menu-button-popup vjs-button" type="button" aria-live="polite" aria-disabled="false" title="Quality" aria-haspopup="true" aria-expanded="false">' + '<div aria-hidden="true" class="vjs-icon-cog"></div>' + '<span class="vjs-control-text">Quality</span></button>' + '<div class="vjs-menu"><ul class="quality_ul vjs-menu-content" role="menu"></ul></div></div>';
   			$(".vjs-fullscreen-control").before(h);
   		} else {
   			$('.quality_ul').empty();
   		}
   		
   		qLevels.sort();
   		qLevels.reverse();
   		
   		var j = 0;
   		
   		$.each(qLevels, function(i, val) {
   			$(".quality_ul").append('<li class="vjs-menu-item" tabindex="' + i + '" role="menuitemcheckbox" aria-live="polite" aria-disabled="false" aria-checked="false" bitrate="' + val +'"><span class="vjs-menu-item-text">' + val + 'p</span></li>');
   			j = i;
   		});
   		
   		$(".quality_ul").append('<li class="vjs-menu-item vjs-selected" tabindex="' + (j + 1) + '" role="menuitemcheckbox" aria-live="polite" aria-disabled="false" aria-checked="true" bitrate="auto">' + '<span class="vjs-menu-item-text">Auto</span></li>');
   	}
   });
   
   $("body").on("click", ".quality_ul li", function() {
   	$(".quality_ul li").removeClass("vjs-selected");
   	$(".quality_ul li").prop("aria-checked", "false");
   	
   	$(this).addClass("vjs-selected");
   	$(this).prop("aria-checked", "true");
   	
   	var val = $(this).attr("bitrate");
   	
   	var qualityLevels = player.qualityLevels();
   	
   	for (var i = 0; i < qualityLevels.length; i++)
   	{
   		qualityLevels[i].enabled = (val == "auto" || (val != "auto" && qualityLevels[i].height == val));
   	}
   });

</script>

Any thoughts?

I actually tried to add the below lines:
videojs.options.hls.overrideNative = true;
videojs.options.html5.nativeAudioTracks = false;
videojs.options.html5.nativeVideoTracks = false;

As a result, the quality button became visible on Chrome (Android) but nothing's changed for Safari (Mobile).

Thanks in advance.

"TypeError: this.player.qualityLevels is not a function"

Description

catch error player.qualityLevels is not a function

I'm using Vuejs and implement video.js for play video hls. I want to change quality of hls video and installed videojs-contrib-quality-levels but still not working. ( Video.js version 7.11.5 has been stabled in my system so i don't want to change version of videoJS ). Any solution? Thanks so much

Environment

"vue": "^2.6.11"
"video.js": "7.11.5"
"videojs-contrib-quality-levels": "^2.0.9",

image

User selects a different quality level, the change is applied very slowly.

Description

I am using videojs-contrib-quality-levels with Video.js for adaptive bitrate streaming. I have encountered an issue where the initial quality level is set to a medium or lower quality by default. When the user selects a different quality level, the change is applied very slowly.

Expected Behavior

  • The initial quality level should start at a higher quality if the network conditions allow.
  • When the user selects a new quality level, the change should be applied more quickly.

Actual Behavior

  • The initial quality level is always set to medium or lower quality.
  • When a new quality level is selected, it takes a long time for the change to reflect in the playback.

Steps to Reproduce

  1. Initialize the Video.js player with videojs-contrib-quality-levels.
  2. Play a video and observe the initial quality level.
  3. Note the delay in applying the selected quality level.

@forbesjo

An in-range update of husky is breaking the build 🚨

The devDependency husky was updated from 1.0.0-rc.15 to 1.0.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

husky is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Commits

The new version differs by 2 commits.

  • d73064e 1.0.0
  • 9b1d8d8 Add 1.0.0 to CHANGELOG.md and consolidate changes since 0.14.3

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

How to properly create qualityLevels from sources?

Description

I have sources:

const sources = [
  {
    src: assets(hdVideo),
    type: "video/mp4",
    label: "1080p"
  },
  {
    src: assets(sdVideo),
    type: "video/mp4",
    label: "480p"
    }
];

How to properly create qualityLevels from these sources?

An in-range update of karma is breaking the build 🚨

The devDependency karma was updated from 3.1.1 to 3.1.2.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

karma is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for v3.1.2

Bug Fixes

Features

Commits

The new version differs by 11 commits.

  • 7d4d347 chore: release v3.1.2
  • 5077c18 chore: update contributors
  • fb05fb1 fix(server): use flatted for json.stringify (#3220)
  • 2682bff feat(docs): callout the key debug strategies. (#3219)
  • 4e87902 fix(changelog): remove release which does not exist (#3214)
  • 30ff73b fix(browser): report errors to console during singleRun=false (#3209)
  • 5334d1a fix(file-list): do not preprocess up-to-date files (#3196)
  • dc5f5de fix(deps): upgrade sinon-chai 2.x -> 3.x (#3207)
  • d38f344 fix(package): bump lodash version (#3203)
  • ffb41f9 refactor(browser): log state transitions in debug (#3202)
  • 240209f fix(dep): Bump useragent to fix HeadlessChrome version (#3201)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Can we hide a specific quality level for video-js-http-source-selector plugin?

Description

Can we hide a specific quality level for video-js-http-source-selector plugin?

Results

Expected

  1. Video should load and will have multiple quality levels ranging from 240 - 1080
  2. If we disable 1080 programmatically, only quality levels from 240-720 should be shown

plugins

video-js-http-source-selector

Question: to display two same resolution 1080p but diff bitrate

Description

Briefly describe the issue.
Include a reduced test case.
I have 4 quality profiles in my HTTP stream
levets

I want to display all 4 profiles
but the problem is I have two 1080p profiles but with different bitrate

one 1080p_high
seconds 1080p_low

I want to display both but the player by default display only 3 profiles 360, 720, 1080

Steps to reproduce

Explain in detail the exact steps necessary to reproduce the issue.

  1. I do player.hlsQualitySelector()
  2. and it display only 3 profiles

Results

Expected

Please describe what you expected to see.

I want to see all profile

360
720
1080p Low
1080p high

Actual

Please describe what actu
ally happened.
it only display 3 profiles

Error output

If there are any errors at all, please include them here.
No errors

Additional Information

Please include any additional information necessary here. Including the following:

versions

videojs

what version of videojs does this occur with?
latest

browsers

what browser are affected?
all

OSes

what platforms (operating systems and devices) are affected?
Linux, windows mac

plugins

are any videojs plugins being used on the page? If so, please list them below.
<script src="dist/videojs-http-streaming.min.js"></script>
<script src="dist/videojs-offset.js"></script>
<script src="dist/videojs-hls-quality-selector.min.js"></script>
<script src="dist/videojs-contrib-quality-levels.min.js"></script>

After changing the enabled levels it takes a while to reflect the change

Description

Despite of starting to download immediately the new resolution after switching it takes a while to actually change the resolution on the player. It's very clear when toggling between 180p to 720p. Am I missing something?

Test url:

https://98w7m059jp.codesandbox.io/

Results

Expected

I expect that when we switch from 180p to 1080p it plays with 1080p right after receiving the first segments.

versions

video.js: "7.1.0"
videojs-contrib-quality-levels: "2.0.5"

HEPL!! Problems in the work of the plug-in with the player version v7.0.3

Hi, I updated the player version. And I had a mistake.

constructor(player: Player, options: Options) {
    super(player, options)
    this.options = options
    const qualityLevels = player.qualityLevels()
    this.quality = []
    qualityLevels.on('addqualitylevel', event => {
      this.quality.push(event.qualityLevel)
      this.update()
    })
  }```

Error:
`player.qualityLevels() undefined`
I can not find the cause of the problem. help me please

unable to change quality on stream in newest version

Description

i'm unable to change quality, streams runs the same one anyway
codepen here.

Steps to reproduce

  1. enter my codepen
  2. check my code
  3. try to push quality buttons down there

Results

Expected

quality can be changed

Actual

quality are still the same even due console log says it's changed, video are still same

versions

videojs

8.6.1

browsers

any

OSes

mac os

plugins

videojs-contrib-quality-levels

An in-range update of conventional-changelog-cli is breaking the build 🚨

The devDependency conventional-changelog-cli was updated from 2.0.5 to 2.0.7.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

conventional-changelog-cli is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.