diff --git a/lib/videojs-resolution-switcher.js b/lib/videojs-resolution-switcher.js index 73ea7f1..65e5f91 100644 --- a/lib/videojs-resolution-switcher.js +++ b/lib/videojs-resolution-switcher.js @@ -324,7 +324,7 @@ groupedSrc = bucketSources(_sources); - // Overwrite defualt sourcePicer function + // Overwrite default sourcePicker function var _customSourcePicker = function(_player, _sources, _label){ player.tech_.ytPlayer.setPlaybackQuality(_sources[0]._yt); return player; @@ -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 default sourcePicker function var _customSourcePicker = function(_player, _sources, _label){ var selectedRes = _sources[0].res; hls.selectPlaylist = selectPlaylist(selectedRes);