Skip to content

Commit

Permalink
Bugfix/offline tutorial sample (#1609)
Browse files Browse the repository at this point in the history
* Fix tracks sorting in Offline tutorial sample code

Sort bandwidths numerically.

Fixes #1608
  • Loading branch information
gigon authored and joeyparrish committed Oct 8, 2018
1 parent 7c11edd commit 29e15b7
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 @@ -21,6 +21,7 @@ Esteban Dosztal <edosztal@gmail.com>
Fadomire <fadomire@gmail.com>
Google Inc. <*@google.com>
Edgeware AB <*@edgeware.tv>
Gil Gonen <gil.gonen@gmail.com>
Giuseppe Samela <giuseppe.samela@gmail.com>
Itay Kinnrot <Itay.Kinnrot@Kaltura.com>
Jason Palmer <jason@jason-palmer.com>
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Duc Pham <duc.pham@edgeware.tv>
Esteban Dosztal <edosztal@gmail.com>
Fadomire <fadomire@gmail.com>
François Beaufort <fbeaufort@google.com>
Gil Gonen <gil.gonen@gmail.com>
Giuseppe Samela <giuseppe.samela@gmail.com>
Itay Kinnrot <itay.kinnrot@kaltura.com>
Jacob Trimble <modmaker@google.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 29e15b7

Please sign in to comment.