Skip to content

Do not lower measured bandwidth with Network Information API#1605

Open
PascalThuet wants to merge 1 commit into
videojs:mainfrom
PascalThuet:codex/network-info-initial-hint
Open

Do not lower measured bandwidth with Network Information API#1605
PascalThuet wants to merge 1 commit into
videojs:mainfrom
PascalThuet:codex/network-info-initial-hint

Conversation

@PascalThuet
Copy link
Copy Markdown

@PascalThuet PascalThuet commented May 21, 2026

Description

Fixes #1604.

When useNetworkInformationApi is enabled, VHS currently uses navigator.connection.downlink as the public bandwidth value whenever Network Information API data is present, except for the existing >= 10 Mbps special case. That can let a lower generic browser-level estimate override a higher player-specific bandwidth estimate after VHS has downloaded media segments.

This change keeps the Network Information API behavior before media segment stats are available, and still allows it to raise the estimate afterward. Once the media segment loader has a player-specific estimate, however, Network Information API no longer lowers that value.

Specific Changes proposed

  • Track whether the main segment loader has a bandwidth estimate from media segment stats.
  • Preserve the existing Network Information API behavior before media segment stats are available.
  • After media segment stats are available, use the larger of the player estimate and the Network Information API estimate.
  • Add unit coverage for both post-segment-stats cases:
    • Network Information API lower than the player estimate.
    • Network Information API higher than the player estimate.
  • Update the useNetworkInformationApi README entry to describe the post-segment-stats behavior.

Requirements Checklist

  • Feature implemented / Bug fixed
  • If necessary, more likely in a feature request than a bug fix
  • Reviewed by Two Core Contributors

Validation:

  • npm run lint
  • CI_TEST_TYPE=unit npm run build-test
  • CI_TEST_TYPE=unit npx karma start scripts/karma.conf.js --single-run --browsers ChromeHeadless

@PascalThuet PascalThuet force-pushed the codex/network-info-initial-hint branch from 07c130d to a7eaf35 Compare May 21, 2026 16:08
@PascalThuet PascalThuet changed the title Use Network Information API as initial bandwidth hint only Do not lower measured bandwidth with Network Information API May 21, 2026
@PascalThuet PascalThuet marked this pull request as ready for review May 21, 2026 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Do not lower player-measured bandwidth with Network Information API

1 participant