Fixed rendition selection so that it always picks the highest bandwidth renditio…
…n for a particular resolution
Showing
1 changed file
with
13 additions
and
3 deletions
... | @@ -714,9 +714,19 @@ videojs.HlsHandler.prototype.selectPlaylist = function () { | ... | @@ -714,9 +714,19 @@ videojs.HlsHandler.prototype.selectPlaylist = function () { |
714 | break; | 714 | break; |
715 | } | 715 | } |
716 | 716 | ||
717 | // we still haven't found a good match so keep a reference | 717 | // If we still haven't found a good match so keep a |
718 | // to the previous variant for the next loop iteration | 718 | // reference to the previous variant for the next loop |
719 | resolutionPlusOne = variant; | 719 | // iteration |
720 | |||
721 | // By only saving variants if they are smaller than the | ||
722 | // previously saved variant, we ensure that we also pick | ||
723 | // the highest bandwidth variant that is just-larger-than | ||
724 | // the video player | ||
725 | if(!resolutionPlusOne || | ||
726 | (variant.attributes.RESOLUTION.width < resolutionPlusOne.attributes.RESOLUTION.width && | ||
727 | variant.attributes.RESOLUTION.height < resolutionPlusOne.attributes.RESOLUTION.height)) { | ||
728 | resolutionPlusOne = variant; | ||
729 | } | ||
720 | } | 730 | } |
721 | 731 | ||
722 | // fallback chain of variants | 732 | // fallback chain of variants | ... | ... |
-
Please register or sign in to post a comment