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

Implemented smooth audio switching

Open krseager opened this issue 4 months ago • 2 comments

This PR will implement smooth audio track switching.

Why is this Pull Request needed?

  • Currently Switching audio tracks causes the Audio Buffer to be flushed immediately upon AUDIO_TRACK_SWITCHING event being fired. This leads to buffering being induced every single time when audio track is switched.
  • The solution now provides a new API for setting the nextAudioTrack, which allows you to utilize existing audio track switching behavior OR to use this new API that automatically schedules the next audio track.

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

  • Ensure API documentation is clear
  • Ensure stream-controller and base-stream-controller refactor does not break anything
  • Ensure new AudioSelectionOption is clear and makes sense

Resolves issues:

  • N/A (Let me know if I need to create an issue for this before merging the PR)

Checklist

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

krseager avatar Oct 13 '25 22:10 krseager

Add unit tests before aproving/merging.

krseager avatar Nov 12 '25 02:11 krseager

@krseager it looks like all the feedback has been addressed - did I miss anything?

Any ETA on adding tests?

robwalch avatar Dec 09 '25 19:12 robwalch