Skip to content

Commit

Permalink
Fix tracks sorting in Offline tutorial sample code (#1609)
Browse files Browse the repository at this point in the history
Sort bandwidths numerically.

Fixes #1608
  • Loading branch information
gigon authored and joeyparrish committed Oct 8, 2018
1 parent 4b413ae commit 57e36ab
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Bryan Huh <bhh1988@gmail.com>
Esteban Dosztal <edosztal@gmail.com>
Google Inc. <*@google.com>
Edgeware AB <*@edgeware.tv>
Gil Gonen <gil.gonen@gmail.com>
Itay Kinnrot <Itay.Kinnrot@Kaltura.com>
Jason Palmer <jason@jason-palmer.com>
Jesper Haug Karsrud <jesper.karsrud@gmail.com>
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Donato Borrello <donato@jwplayer.com>
Duc Pham <duc.pham@edgeware.tv>
Esteban Dosztal <edosztal@gmail.com>
François Beaufort <fbeaufort@google.com>
Gil Gonen <gil.gonen@gmail.com>
Itay Kinnrot <itay.kinnrot@kaltura.com>
Jacob Trimble <modmaker@google.com>
Jason Palmer <jason@jason-palmer.com>
Expand Down
8 changes: 4 additions & 4 deletions docs/tutorials/offline.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ function selectTracks(tracks) {
// Store the highest bandwidth variant.
var found = tracks
.filter(function(track) { return track.type == 'variant'; })
.sort(function(a, b) { return a.bandwidth > b.bandwidth; })
.sort(function(a, b) { return a.bandwidth - b.bandwidth; })
.pop();
console.log('Offline Track: ' + found);
console.log('Offline Track bandwidth: ' + found.bandwidth);
return [ found ];
}

Expand Down Expand Up @@ -487,9 +487,9 @@ function selectTracks(tracks) {
// Store the highest bandwidth variant.
var found = tracks
.filter(function(track) { return track.type == 'variant'; })
.sort(function(a, b) { return a.bandwidth > b.bandwidth; })
.sort(function(a, b) { return a.bandwidth - b.bandwidth; })
.pop();
console.log('Offline Track: ' + found);
console.log('Offline Track bandwidth: ' + found.bandwidth);
return [ found ];
}

Expand Down

0 comments on commit 57e36ab

Please sign in to comment.