Skip to content

Do not lower player-measured bandwidth with Network Information API #1604

@PascalThuet

Description

@PascalThuet

Please do not delete the template, by filling out the required information we can investigate your issue more quickly.

Before opening an issue see if your problem can be resolved with the troubleshooting guide.

Description

When useNetworkInformationApi is enabled and navigator.connection.downlink is available, VhsHandler#bandwidth can return the browser's generic Network Information API downlink estimate even after VHS has a player-specific bandwidth estimate from downloaded media segments.

This can let a lower browser-level estimate reduce the bandwidth used by ABR selection, even though the media segment loader has measured a higher bandwidth for the current media/CDN path.

The Network Information API value is still useful as a hint and as protection against player-side underestimation. However, once media segment transfer stats are available, it should not lower the player-specific estimate. A reduced unit test for this behavior is included in the linked PR.

Sources

This is not limited to one asset, but it was observed while investigating startup quality on this public HLS source:

https://www.arte.tv/fr/videos/121229-000-A/le-proces-goldman/

Steps to reproduce

Explain in detail the exact steps necessary to reproduce the issue.

  1. Use Chrome/Chromium so navigator.connection.downlink is available.
  2. Configure VHS with html5.vhs.useNetworkInformationApi: true.
  3. Load an adaptive source with renditions above the value reported by navigator.connection.downlink.
  4. Let media segment requests complete so mainSegmentLoader_.bandwidth has a player-specific estimate.
  5. Inspect player.tech_.vhs.bandwidth, or observe ABR selection, when navigator.connection.downlink is lower than the segment-derived player estimate.

Results

Expected

Before media segment stats are available, VHS may use navigator.connection.downlink as an initial bandwidth estimate.

After media segment stats are available, Network Information API should still be allowed to raise the bandwidth estimate, but it should not lower a player-specific media segment estimate.

Error output

No console error is required to reproduce this. The issue is the bandwidth estimate used by the ABR selector.

Additional Information

This behavior comes from the current bandwidth getter logic:

  • if useNetworkInformationApi is true and Network Information API is present, VHS uses networkInformation.downlink * 1000 * 1000;
  • unless both the Network Information API estimate and the player estimate are >= 10 Mbps, the browser estimate replaces the player estimate.

That means a lower browser-level estimate can continue winning even after VHS has measured the current media transfer path.

videojs-http-streaming version

Current main, observed against @videojs/http-streaming 3.17.4 code.

videojs version

video.js 8.x.

Browsers

Chrome / Chromium browsers that expose navigator.connection.downlink.

Platforms

Observed while testing on macOS with Chrome. The behavior should apply to any platform/browser combination that exposes the Network Information API.

Other Plugins

None required.

Other JavaScript

None required.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions