feat(api): add MPEG-DASH streaming support via dash.js - #1190
Merged
Conversation
Adds DASH as a second adaptive-streaming backend in src/api/video.ts, mirroring the existing hls.js integration: load/play/pause/seek/stop, error handling with recovery, and audio/subtitle track enumeration and selection sharing a common locale-priority selector with the HLS path. dash.js is loaded through a dynamic import kept in the main bundle via webpackMode: "eager" (its imsc/TTML dependency touches `window` at module-load time, which breaks a static import outside a browser, and a real split chunk would silently require integrators to deploy an extra file beyond the documented brs.api.js + brs.worker.js contract). A load-generation counter guards the resulting async gap against a stale dash.js instance attaching after a newer load or stop. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
src/api/video.ts, alongside the existing hls.js integration, following the same load/play/pause/seek/stop and error-handling shape (create/destroy lifecycle, error-code classification, bandwidth reporting).dash.jsis loaded via a dynamic import kept in the main bundle (webpackMode: "eager"): itsimsc/TTML dependency toucheswindowat module-load time, which breaks a static import outside a browser (e.g. the Node-based test suite); a real split chunk would also silently require integrators to deploy an extra file beyond the documentedbrs.api.js+brs.worker.jscontract.videoFormats()/canDecodeVideo()now report"dash"container support.docs/limitations.mdupdated — DASH is no longer listed as unsupported.roVideoPlayerandVideonode #248Test plan
npm run lint/npm run prettiercleanvitestsuite passes (216 test files / 2764 tests)brs.api.js+brs.worker.js(no stray chunk file)elephants_dreamMPD): playback starts, audio track enumeration works, position updates, pause/seek/stop behave correctly/code-reviewand/simplifypasses; fixed a load-order race, adash.jsinstance memory leak, and de-duplicated the HLS/DASH track-selection and error-reporting code🤖 Generated with Claude Code