mirror of
https://github.com/kmoskwiak/videojs-resolution-switcher.git
synced 2025-10-03 17:59:42 +02:00
Sort sources by resolution. Fix typo.
This commit is contained in:
parent
e3556aeaa3
commit
e7bba46933
1 changed files with 7 additions and 5 deletions
|
@ -352,10 +352,12 @@
|
|||
});
|
||||
|
||||
player.one('loadedmetadata', function(){
|
||||
var playlists = hls.playlists.master.playlists;
|
||||
|
||||
var playlists = hls.playlists.master.playlists.sort(function (a, b) {
|
||||
return b.attributes.RESOLUTION.height - a.attributes.RESOLUTION.height;
|
||||
});
|
||||
|
||||
var _sources = [{ src: 'auto', type: 'application/x-mpegURL', label: 'auto', res: 'auto'}];
|
||||
|
||||
|
||||
playlists.map(function(value){
|
||||
_sources.push({
|
||||
src: value.uri,
|
||||
|
@ -383,7 +385,7 @@
|
|||
return _selectPlaylist;
|
||||
};
|
||||
|
||||
// Overwrite defualt sourcePicer function
|
||||
// Overwrite defualt sourcePicker function
|
||||
var _customSourcePicker = function(_player, _sources, _label){
|
||||
var selectedRes = _sources[0].res;
|
||||
hls.selectPlaylist = selectPlaylist(selectedRes);
|
||||
|
@ -432,4 +434,4 @@
|
|||
// register the plugin
|
||||
videojs.plugin('videoJsResolutionSwitcher', videoJsResolutionSwitcher);
|
||||
})(window, videojs);
|
||||
})();
|
||||
})();
|
Loading…
Add table
Add a link
Reference in a new issue