Closed campones closed 7 years ago
This plugin is used in combinations with other playback plugins (like videojs-contrib-hls) that populate the quality list. See https://github.com/videojs/videojs-contrib-quality-levels#populating-the-list
If you are using an HLS source keep an eye on https://github.com/videojs/videojs-contrib-hls/pull/929 which should be in the next minor version of that script. Additionally this plugin does not provide a UI, just an API that you can build your own UI around.
yes I m using (rather testing tbh since at the moment hls.js works better) videojs-contrib-hls along with your script. i ll keep an eye on this, thanks!
hi,
why qualityLevels is zero 0. My video is playing correct, source is HLS format.
var player = videojs("video"); var qualityLevels = player.qualityLevels().length; for (var i = 0; i < qualityLevels.length; i++) { var quality = qualityLevels[i]; if (quality.width >= 720) { quality.enabled = true; } else { quality.enabled = false; } }
@campones videojs/videojs-contrib-hls#929 has been merged in so if you use the latest version of contrib-hls, you should see your quality list being populated.
@WeBBLiu in the second line of your snippet, var qualityLevels = player.qualityLevels().length
should be var qualityLevels = player.qualityLevels()
. you are settings the variable qualityLevels
to the list's length, not the list itself
@mjneil I change my code , but still not working. qualityLevels.length is zero.
version: videojs-contrib-hls v5.1.1 videojs-contrib-quality-levels v2.02
var qualityLevels = player.qualityLevels(); console.log(qualityLevels.length); for (var i = 0; i < qualityLevels.length; i++) { var quality = qualityLevels[i]; if (quality.width >= 720) { quality.enabled = true; } else { quality.enabled = false; } }
@WeBBLiu can you make a separate issue for your problem? If you can, edit this jsbin to show the failing behavior you are seeing
I am using videojs-contrib-hls v5.3.2, videojs-contrib-quality-levels V2.0.3 and Video js V5.18.0,
But Getting the same issue there is no population of Qualities in the player and if I am trying to get in the console then player.qualityLevels().length
returns 0.
due to this the loop is not running and facing the same issue as WeBBLiu does.
The JSBIN you provided is not containing videojs-contrib-quality-levels.js.
Can you please suggest me what to do to solve it. Code what I am using is :-
<script>
var options = {
"playbackRates": [.25,.5,1, 1.5, 2],
"preload":'auto',
controlBar: {
volumeMenuButton: {
vertical: true,
inline: false,
volumeBar: {
vertical: true
},
volumeLevel: true
}
}
};
var player = videojs('player-video', options);
player.src({
src: "http://www.streambox.fr/playlists/x36xhzz/x36xhzz.m3u8",
type: 'application/x-mpegURL',
});
player.qualityLevels();
var vrlist= player.qualityLevels();
console.log(vrlist.length);
</script>
HTML :-
<video id="player-video" width=600 height=300 class="video-js vjs-default-skin" controls></video>
The qualities are not immediately available as the player needs to download the master manifest to determine if there are any renditions in the stream. You should listen to the addqualitylevel
event on the QualityLevelList
to use the QualityLevels as soon as they are added to the list. Here is a jsbin demonstrating an example usage using your snippet @rohityadv876 http://jsbin.com/qolubesegi/edit?html,console,output This should also help you @WeBBLiu if you are still experiencing issues.
Thank you for sharing this excellent plugin. Suggest the sentence below get on to the front page READE. It was obvious to me only in retrospect ;)
this plugin does not provide a UI, just an API that you can build your own UI around.
I have an example of implementation for videojs. It might help you. https://radek350.wordpress.com/category/video-html-streaming/videojs/
That is excellent thank you. Done long ago. I think we are finding it is better in our case to send down the menu from server since we encoded and know/store all the variants with the video data record. That avoids some delay.
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?