0049b9c9 by David LaPalomento

Document the playlist bandwidth comparator

Add some information on how to use the playlistBandwidth function.
1 parent 3fc85b5f
...@@ -38,6 +38,15 @@ var ...@@ -38,6 +38,15 @@ var
38 // temporary flucations in client bandwidth 38 // temporary flucations in client bandwidth
39 bandwidthVariance = 1.1, 39 bandwidthVariance = 1.1,
40 40
41 /**
42 * A comparator function to sort two playlist object by bandwidth.
43 * @param left {object} a media playlist object
44 * @param right {object} a media playlist object
45 * @return {number} Greater than zero if the bandwidth attribute of
46 * left is greater than the corresponding attribute of right. Less
47 * than zero if the bandwidth of right is greater than left and
48 * exactly zero if the two are equal.
49 */
41 playlistBandwidth = function(left, right) { 50 playlistBandwidth = function(left, right) {
42 var leftBandwidth, rightBandwidth; 51 var leftBandwidth, rightBandwidth;
43 if (left.attributes && left.attributes.BANDWIDTH) { 52 if (left.attributes && left.attributes.BANDWIDTH) {
......