-
Notifications
You must be signed in to change notification settings - Fork 76
[react-native] WebRTC TrackSubscribed handler uses web-only DOM APIs #641
Copy link
Copy link
Open
Description
Problem
The TrackSubscribed handler in WebRTCConnection.ts (line 355-401) uses web-only APIs that don't exist in React Native:
remoteAudioTrack.attach()internally callsdocument.createElement('audio')document.body.appendChild(audioElement)setupAudioCapture()usesAudioContextandAudioWorkletNode
Since v1.0.0 defaults to WebRTC for voice connections, and the React Native setup strategy (reactNativeSessionSetup) delegates to webSessionSetup() without any RN-specific WebRTC handling, this code path runs unguarded on React Native.
Impact
- The async handler throws, so
setupAudioCaptureis never reached - No
onAudiocallback fires for agent audio - No output analyser available (
getOutputByteFrequencyDatareturns null) setVolume()has no effect (emptyaudioElementsarray)- Audio may still play via LiveKit's native WebRTC layer, but mode/callbacks are broken
Found during
Investigation of #635
Suggested fix
Guard the DOM-specific code in the TrackSubscribed handler to skip attach(), appendChild, and setupAudioCapture when running in React Native, relying on LiveKit's native audio playback instead.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels