Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HLS-Tech Sort sources by resolution. Fix some typos. #98

Open
wants to merge 3 commits into
base: hls-tech
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions lib/videojs-resolution-switcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down