how to get remote participant audio track and then...
# ask-ai
n
how to get remote participant audio track and then i can use audio
t
Thanks for reaching out, Darshak. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
It sounds like you want to access a remote participant’s audio track so you can use it in your app. If you’re using the client SDK (browser/React): 1. Listen for when a track is subscribed. 2. Check that it’s an audio track, then use the track (play or attach to an element). Example:
Copy code
room.on(RoomEvent.TrackSubscribed, (track, publication, participant) => {
  if (publication.kind === Track.Kind.Audio && track.kind === Track.Kind.Audio) {
    // Start playback (SDK handles it), or attach manually:
    const el = document.createElement('audio');
    el.autoplay = true;
    track.attach(el);
    document.body.appendChild(el);
  }
});
More on subscribing: Subscribing to tracks If you need raw audio for processing (agents/server-side): • Wrap the subscribed audio track with an
AudioStream
and iterate `AudioFrame`s for processing. Docs and patterns: Processing raw media tracks and Capturing the first seconds of a call Would you like a snippet for your specific environment (browser, React, or agent/backend)? Sources: Rooms, participants, and tracks | LiveKit docs | Core Platform Architecture & Authentication | livekit/livekit_composite | D... | Subscribing to tracks | LiveKit docs | Capturing the First Few Seconds of a Call for Processing | How to set a fixed participant for agent audio processing
n
I want to implement from Backend side is there any event or anything that i can subscribe ?
t
It sounds like you want a backend way to “subscribe” to remote audio and get events when it’s available. Yes—use a backend/agent that joins the room, listens for the track subscription event, then reads audio frames: • Join with auto-subscribe (or subscribe selectively), then handle the track-subscribed callback. • For processing, wrap the audio track in an
AudioStream
and iterate `AudioFrame`s. References: • Overview of rooms/participants/tracks: docs • Capturing/processing audio frames server-side: guide If you share which backend SDK you’re using (Node, Python, Go, etc.), I can provide the exact event name and a minimal code snippet. Sources: Rooms, participants, and tracks | LiveKit docs | Capturing the First Few Seconds of a Call for Processing | Camera & microphone | LiveKit Docs | An open source stack for real-time multimodal AI | Live Conversations with AI using ChatGPT and WebRTC
n
what is event for track_published ?
t
It sounds like you’re asking for the backend event name when a participant publishes a track. • Webhooks: the event is “Track Published.” See the list of webhook events here: Webhooks | LiveKit Docs • Backend/agents (in-process): handle the track-published flow by subscribing when your SDK signals a new publication, then process on track-subscribed. If you share your SDK (Python/Node/Go), I’ll give the exact handler name and a minimal snippet. Sources: Webhooks | LiveKit Docs | Protocol & WebRTC Stack | livekit/livekit_composite | DeepWiki | Live Conversations with AI using ChatGPT and WebRTC | Capturing the First Few Seconds of a Call for Processing | Track Composite Egress | LiveKit Docs