Skip to content

fix(capability): bound the native audio probe's play() so its element is always removed - #2

Open
arman258 wants to merge 1 commit into
AIOStreams:aiostreamsfrom
arman258:fix/bound-native-audio-probe-play
Open

arman258 wants to merge 1 commit into
AIOStreams:aiostreamsfrom
arman258:fix/bound-native-audio-probe-play

Conversation

@arman258

Copy link
Copy Markdown

runDefaultExactPlaybackProbe (src/capability/NativeMediaAudioCapabilities.ts) bounds each of its waits with the probe timeout except await audioElement.play(). If play() never settles, the finally block that pauses and removes the hidden <audio> never runs. The cached probe promise never settles either.

On an LG OLED (webOS 11.2.0, AIOStreams smart-tv 0.13.0), a WebGPU start where requestAdapter() returned null left 4 such elements on the page: AC-3/E-AC-3 × 2/6 channels, blob: sources, readyState 1, not paused. webOS's media service showed both of the TV's audio decoders still owned by the app, and every later play failed until the app was closed. The adapter failure doesn't cancel these probes, which chooseRoute started. Pausing them or clearing src from DevTools didn't free the decoders.

This change races play() against the same probe timeout as the other steps, so a probe that can't start still reaches finally and removes its element.

Why play() hangs on webOS (no free decoder) is inferred from that state, not proven. I haven't run this build on the TV yet. Typecheck, eslint and the capability tests (34) pass. Context: Viren070/AIOStreams#1916.

🤖 Generated with Claude Code

… is always removed

Every other stage of the exact playback probe has a timeout, but play()
did not. On LG webOS 11 the four probes (AC-3 and E-AC-3, 2 and 6
channels) ran side by side and stayed in the page afterwards: muted,
hidden <audio> elements with blob: sources, readyState 1 and not paused,
so the finally block that removes them never ran. They kept the TV's
audio decoders, and every later playback in the page failed until the
app was closed. A play() that hasn't settled within the probe timeout now
counts as a timeout, and the teardown runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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