Skip to content

Commit

Permalink
Fix tracks sorting in Offline tutorial sample code
Browse files Browse the repository at this point in the history
Sort bandwidths numerically instead of lexicographically.

Fixes shaka-project#1608
  • Loading branch information
Gil Gonen committed Oct 8, 2018
1 parent 17e5c8a commit df1c97d
Showing 1 changed file with 4 additions and 4 deletions.
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 df1c97d

Please sign in to comment.