7671b5a0 by jrivera

Fixed rendition selection so that it always picks the highest bandwidth renditio…

…n for a particular resolution
1 parent af7f8e21
......@@ -714,9 +714,19 @@ videojs.HlsHandler.prototype.selectPlaylist = function () {
break;
}
// we still haven't found a good match so keep a reference
// to the previous variant for the next loop iteration
resolutionPlusOne = variant;
// If we still haven't found a good match so keep a
// reference to the previous variant for the next loop
// iteration
// By only saving variants if they are smaller than the
// previously saved variant, we ensure that we also pick
// the highest bandwidth variant that is just-larger-than
// the video player
if(!resolutionPlusOne ||
(variant.attributes.RESOLUTION.width < resolutionPlusOne.attributes.RESOLUTION.width &&
variant.attributes.RESOLUTION.height < resolutionPlusOne.attributes.RESOLUTION.height)) {
resolutionPlusOne = variant;
}
}
// fallback chain of variants
......