hls.js icon indicating copy to clipboard operation
hls.js copied to clipboard

Use ResizeObserver to cap level to player size

Open robwalch opened this issue 11 months ago • 0 comments

This PR will...

Use ResizeObserver when available in cap-level-controller.

Why is this Pull Request needed?

Using capLevelToPlayerSize to detect the media element dimensions forces layout. The ResizeObserver avoids this speeding up player setup.

Are there any points in the code the reviewer needs to double check?

Might want to debounce calling this.detectPlayerSize in the observer callback to avoid setting the level more than once when the media element size is animated by the browser during transitions like entering and exiting fullscreen.

Resolves issues:

Checklist

  • [ ] changes have been done against master branch, and PR does not conflict
  • [ ] new unit / functional tests have been added (whenever applicable)
  • [ ] API or design changes are documented in API.md

robwalch avatar Mar 19 '25 21:03 robwalch