videojs / http-streaming

HLS, DASH, and future HTTP streaming protocols library for video.js
https://videojs-http-streaming.netlify.app/
Other
2.53k stars 425 forks source link

fix regression: prevent wrapping in resetMainLoaderReplaceSegments #1439

Closed pulsejet closed 1 year ago

pulsejet commented 1 year ago

This fixes a regression introduced in 4590bdd05aa2dd59bb2b60ce86daf453a093fba0

If the quality is changed during initialization, this function is called. Since buffered.length is zero and buffered is a TimeRanges, length (an unsigned long) wraps around and becomes 4294967295

PsVideo.ts:462 DOMException: Failed to execute 'end' on 'TimeRanges': The index provided (4294967295) is greater than the maximum bound (0).
    at PlaylistController.resetMainLoaderReplaceSegments (http://localhost:8035/apps/memories/js/memories-vendors-node_modules_plyr_dist_plyr_css-node_modules_video_js_dist_video-js_min_css-node_modu-82e78d.js?v=7e8851a5e7ef114c9398:65070:34)
    at PlaylistController.fastQualityChange_ (http://localhost:8035/apps/memories/js/memories-vendors-node_modules_plyr_dist_plyr_css-node_modules_video_js_dist_video-js_min_css-node_modu-82e78d.js?v=7e8851a5e7ef114c9398:65060:10)
    at QualityLevel.enabled_ (http://localhost:8035/apps/memories/js/memories-vendors-node_modules_plyr_dist_plyr_css-node_modules_video_js_dist_video-js_min_css-node_modu-82e78d.js?v=7e8851a5e7ef114c9398:66129:5)
    at QualityLevel.set (http://localhost:8035/apps/memories/js/memories-vendors-node_modules_plyr_dist_plyr_css-node_modules_video_js_dist_video-js_min_css-node_modu-82e78d.js?v=7e8851a5e7ef114c9398:42975:15)
    at VideoContentSetup.changeQuality (http://localhost:8035/apps/memories/js/memories-main.js:60373:40)
welcome[bot] commented 1 year ago

πŸ’– Thanks for opening this pull request! πŸ’–

Things that will help get your PR across the finish line:

We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

pulsejet commented 1 year ago

@adrums86

codecov[bot] commented 1 year ago

Codecov Report

Merging #1439 (577f70d) into main (beccfa1) will not change coverage. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #1439   +/-   ##
=======================================
  Coverage   85.94%   85.94%           
=======================================
  Files          42       42           
  Lines       10436    10436           
  Branches     2414     2415    +1     
=======================================
  Hits         8969     8969           
  Misses       1467     1467           
Files Coverage Ξ”
src/playlist-controller.js 95.80% <100.00%> (ΓΈ)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

welcome[bot] commented 1 year ago

Congrats on merging your first pull request! πŸŽ‰πŸŽ‰πŸŽ‰

pvieira91 commented 1 year ago

First of all thanks for the work you have been doing. We've been using video.js for some years and it's fantastic. Since we started using HLS we started to get some errors in sentry. I believe this commit fixes our issue. Can you please tell me when a new version will be released?

Thanks

IndexSizeError: Failed to execute 'end' on 'TimeRanges': The index provided (4294967295) is greater than the maximum bound (0).
  at Mf.resetMainLoaderReplaceSegments (/public/frontend/_assets/videojs.2328859c5a34d65c05ea1c.js:181:38223)