Skip to content

feat(embed): play DTS and TrueHD on the native video clock - #1

Open
willtho89 wants to merge 15 commits into
AIOStreams:aiostreamsfrom
willtho89:feat/webos-native-audio
Open

willtho89 wants to merge 15 commits into
AIOStreams:aiostreamsfrom
willtho89:feat/webos-native-audio

Conversation

@willtho89

@willtho89 willtho89 commented Nov 19, 2026 •

Copy link
Copy Markdown

On an LG G5 running webOS 10, the native video element can play 4K Dolby Vision from an MKV while the selected DTS-HD MA track is silent. Switching audio tracks does not help when every language uses DTS. This adds an optional NativeDtsPlayback.js entry point for hosts that already own a video element.

The module copies the compressed video packets and uses the existing packaged DTS or TrueHD decoder for the selected audio track when needed. It sends the decoded samples as FLAC to a second Media Source buffer on the same element. Both tracks then use the native media clock for playback, pause and seek. The stereo mix includes the center channel. Compatible companion tracks retain their original audio ordinals. A host can also consume Matroska subtitle blocks as they are read.

The Mediabunny patches preserve single-layer Dolby Vision metadata during remux and initialize disposal symbols on older engines. The embed build includes the FLAC encoder and its license notices. The embed package proposes version 0.6.0 and lists the licenses of the bundled FLAC components. It uses the published decoder packages.

Verification

  • At 463ddaa, all 6,738 tests and TypeScript passed with the pinned decoder packages. The base branch passed all 6,706 tests under the same setup. Full lint reports the same three pre-existing findings in GPUVideoDecodeSession.ts and EmbeddedPlayer.ts.

  • With H.264 keyframes at 0, 10, 20 and 30 seconds, Edge last presented a frame at 8.32 seconds on 6b420c0 while its audio clock reached EOF. On 463ddaa, frames were presented in the final GOP, and playback reached 30.6 seconds. At 18.04 seconds the video eviction retained the buffered range from 10 to 20 seconds. A second transport stream with a 600.137-second source origin also played through the trim.

  • The pause, sample-rate and display-matrix regressions were reproduced on 12e86c3 and retested on 6b420c0 in Edge. With a 1 MiB video buffer and three seconds playable, the player waited through a deliberate pause and reached the end after resuming. A quota too small to prime still reached the host error callback. The real FLAC muxer wrote 48 kHz for a DTS bitstream starting at 50 ms in a 44.1 kHz MKV. Direct and remuxed playback of a horizontally mirrored MOV showed the same arrangement of color quadrants. A pre-existing RGB difference between the direct and MSE paths was also present on the old build.

  • The three fixtures are in test/embed/fixtures/. The self-running Edge tests are in test/embed/NativeDtsPlayback.browser.html. At player revision 6b420c0, the AIOStreams companion branch built IPK and WGT archives with all 50 library files matching the local npm package byte for byte.

  • In desktop Edge, all four 14-second H.264 clips with DTS or TrueHD starting at second 2 or ending at second 4 played to the end. Selecting an AAC passthrough track with either gap reached the host error callback. A 1 MiB video append limit produced a host error after ten rejections at time zero. The jsdom integration tests also cover recovery when playback frees buffer space.

  • For two 36.1 MiB HTTP inputs without header durations, Edge read 3.76 MiB from indexed MKV and 0.69 MiB from indexed fragmented MP4 during preparation. An MKV without an index returned to the direct path after 8.31 MiB total. A rotated MOV reported 180 × 320 on the remux path.

  • On an LG OLED C3 (webOS 11.2), the packaged module from 463ddaa played the same 30.6-second long-GOP H.264/DTS fixture to EOF inside AIOStreams. At 18.16 seconds, video eviction preserved the buffered range from 10 to 20 seconds. In a second 33-second clip with one color per GOP, TV output captures at 3.16, 13.08, 23.12 and 30.72 seconds showed red, green, blue and yellow respectively. Both runs finished without a waiting event after playback started.

  • The following LG checks used earlier revisions.

  • On both the LG G5 and desktop Edge, the previous build stalled at 0.30 s on an H.264/DTS MKV with an early audio track and a late first video keyframe. The updated module played the same clip to 12.00 s. The G5 also loaded the packaged DTS and TrueHD decoder files using their content-keyed URLs.

  • In Edge, a 16-second clip recovered from a single HTTP 503. A persistent 503 reached the host error callback after three requests. A seek outside the buffer kept native pause and 1.5× playback speed.

  • On the LG G5, a 4K HEVC Dolby Vision Profile 8.1 MKV played with the selected DTS-HD MA track and German PGS subtitles. Dialogue was audible on the TV speakers. A TrueHD MKV and DTS clips in MKV, MP4, MOV, TS and M2TS reached the end. Seeking beyond the buffered range worked on an M2TS whose source clock started above 600 seconds.

  • On an LG OLED C3 (webOS 11.2), the packaged module played H.264 MKV clips with DTS 5.1 and TrueHD 5.1 to completion inside AIOStreams. The app reported two output channels. During a 40-second DTS clip, a Sonos Arc connected over HDMI reported PCM 2.0.

  • eARC surround output and Atmos metadata have not been verified. The companion AIOStreams PR is feat(web): play DTS and TrueHD with native video on webOS Viren070/AIOStreams#1890.

@willtho89 willtho89 changed the title Play DTS and TrueHD audio on the native video clock feat(embed): play DTS and TrueHD on the native video clock Nov 19, 2026
@willtho89

Copy link
Copy Markdown
Author

Hi @Viren070, would you be willing to review the native DTS/TrueHD playback changes when you have a chance? I've tested the playback path on an LG C3 and G5. Thanks!

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.

1 participant