You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.9 KiB

  1. # Adaptive Switching Behavior
  2. The HLS tech tries to ensure the highest-quality viewing experience
  3. possible, given the available bandwidth and encodings. This doesn't
  4. always mean using the highest-bitrate rendition available-- if the player
  5. is 300px by 150px, it would be a big waste of bandwidth to download a 4k
  6. stream. By default, the player attempts to load the highest-bitrate
  7. variant that is less than the most recently detected segment bandwidth,
  8. with one condition: if there are multiple variants with dimensions greater
  9. than the current player size, it will only switch up one size greater
  10. than the current player size.
  11. If you're the visual type, the whole process is illustrated
  12. below. Whenever a new segment is downloaded, we calculate the download
  13. bitrate based on the size of the segment and the time it took to
  14. download:
  15. ![New bitrate info is available](bitrate-switching-1.png)
  16. First, we filter out all the renditions that have a higher bitrate
  17. than the new measurement:
  18. ![Bitrate filtering](bitrate-switching-2.png)
  19. Then we get rid of any renditions that are bigger than the current
  20. player dimensions:
  21. ![Resolution filtering](bitrate-switching-3.png)
  22. We don't want to signficant quality drop just because your player is
  23. one pixel too small, so we add back in the next highest
  24. resolution. The highest bitrate rendition that remains is the one that
  25. gets used:
  26. ![Final selection](bitrate-switching-4.png)
  27. If it turns out no rendition is acceptable based on the filtering
  28. described above, the first encoding listed in the master playlist will
  29. be used.
  30. If you'd like your player to use a different set of priorities, it's
  31. possible to completely replace the rendition selection logic. For
  32. instance, you could always choose the most appropriate rendition by
  33. resolution, even though this might mean more stalls during playback.
  34. See the documentation on `player.hls.selectPlaylist` for more details.