feat(spf): expose audio tracks & renditions on the SPF media adapter - #1811
feat(spf): expose audio tracks & renditions on the SPF media adapter#1811spuppo-mux wants to merge 4 commits into
Conversation
|
@spuppo-mux is attempting to deploy a commit to the Mux Team on Vercel. A member of the Team first needs to authorize it. |
✅ Deploy Preview for vjs10-site ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit cf4dc03. Configure here.
| } | ||
|
|
||
| const sameAudioTracks = (a: AudioTrackInfo[] | undefined, b: AudioTrackInfo[]): boolean => | ||
| !!a && a.length === b.length && a.every((track, index) => track.id === b[index]?.id); |
There was a problem hiding this comment.
Stale audio trackIds skipped
Medium Severity
sameAudioTracks treats a reload as unchanged when collapsed track ids match, but getAudioTracks can still produce different trackIds for the same slots. The engine then keeps stale trackIds, so selectedAudioTrackId may not match and the DOM adapter can show the wrong language as enabled.
Reviewed by Cursor Bugbot for commit cf4dc03. Configure here.
|
Re-implemented in #1826 |


Part 2 of #1795 (video → audio → streamType → live → parity/autoplay).
Based on #1803 (not using that as a base because the branch is on my fork so correct this after 1803 is merged)
What changed
getAudioTracks(state)selector collapses the model's per-(language x quality-group) audio tracks into one AudioTrackInfo per (language, name), carrying trackIds.deriveAudioTracksbehavior publishesstate.audioTracks(same reactor asderiveVideoRenditions: derive on resolve, clear on unload, skip unchanged).AudioTrackList (kind = default ? 'main' : 'alternative', label = name, language); reflects enabled from selectedAudioTrackId; feeds a newly-enabled track back touserAudioTrackSelection.Design decisions
selectedAudioTrackId(a specific group) back to its language track.enabledreflects the resolvedselectedAudioTrackId, not the track pinned by the user. Audio exposes a singleenabledproperty (vs. video which exposes active + selected). It's restored on rebuild via the untracked reflect in#projectAudioTracks.Deferred:
audioRenditionsLeft empty (as in HlsJsMedia, which never populates it).
Test plan
<simple-hls-video>.audioTracksflows throughCustomMediaElementautomatically (same path as video).Note
Medium Risk
Touches playback track selection and DOM↔engine sync with feedback-loop guards; behavior is well covered by tests but mistakes could affect ABR pinning or audio switching at runtime.
Overview
Exposes video renditions and audio tracks on the Simple HLS DOM media element by deriving engine signals from the resolved presentation and projecting them onto
videoRenditions/audioTracks, with two-way wiring for quality and language selection.SPF layer: Adds
getVideoRenditionsandgetAudioTracks(audio collapsed to one entry per language+name withtrackIdsfor quality-group mapping). NewderiveVideoRenditionsandderiveAudioTracksbehaviors publishstate.videoRenditionsandstate.audioTrackson resolve, clear on unload, and skip redundant writes when the id-set is unchanged. Both are composed into the Simple HLS engine.Core adapter:
SimpleHlsMedianow stacksMediaTracksMixinandSimpleHlsMediaMediaTracksMixin, which sync engine signals to DOM track lists, reflect active/selected renditions and enabled audio from engine selection, forward user picks touserVideoTrackSelection/userAudioTrackSelection(including ABR when rendition index is -1), and re-subscribe on eachsrcchange because the SPF engine is recreated per assignment.Reviewed by Cursor Bugbot for commit cf4dc03. Bugbot is set up for automated code reviews on this repo. Configure here.