How can we get the remote participants device deta...
# ask-ai
w
How can we get the remote participants device details like bowser agent or mic enabled or not?
t
Thanks for reaching out, Chiranjeevi. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'd be happy to help you retrieve remote participants' device details and microphone status in LiveKit! Here's how you can do it: • Microphone and Camera Status: You can check if the microphone or camera is enabled by using the
isMicrophoneEnabled
and
isCameraEnabled
properties on the
Participant
object. • Browser and Device Details: These are parsed on the server side and aren't directly available in the client SDK. But don't worry! You can still access them by: 1. Parsing the device and browser information on the client side using
navigator.userAgent
. 2. Sharing this information with other participants through metadata (
setMetadata()
) or data messages (
publishData()
). 3. Then, processing the received data on the remote side to get the details you need. If you'd like, I’m here to guide you through the implementation or answer any questions you might have. Just let me know! Sources: livekit-protocol/livekit/protocol/models.py | Managing participants | LiveKit Docs | src/utils/browserParser.test.ts | Runtime/Scripts/Room/Participant/Participant.cs
w
I need these data in agent I ma using python sdk
t
I'd be happy to help you retrieve remote participants' device details and microphone status using the Python SDK in LiveKit. Here's a simple way to get started: • Microphone Status: You can check the
track_publications
dictionary on a
RemoteParticipant
object. Look for tracks where
source == rtc.TrackSource.SOURCE_MICROPHONE
and see if they are
muted
. • Device Metadata: LiveKit provides some useful high-level metadata like OS, browser, and SDK type through the
ClientInfo
protocol. However, detailed hardware info isn’t directly available. • Custom Device Info Sharing: If you need more specific device details, participants can share this information by sending it via metadata or data messages. If you’d like, I can also help you with some Python code examples or guide you through the implementation. Just let me know—I’m here to support you! Sources: stream_audio.py | livekit-rtc/livekit/rtc/room.py
w
Can help with example code for those details
t
I'd love to help you with retrieving remote participants' microphone status and sharing device details using the Python SDK! Here's a simple example to guide you through it: 1. Retrieve Microphone Status
Copy code
from livekit import rtc

def check_microphone_status(participant: rtc.RemoteParticipant):
    for publication in participant.track_publications.values():
        if publication.source == rtc.TrackSource.SOURCE_MICROPHONE:
            print(f"Microphone track: {publication.sid}, Muted: {publication.muted}")
            return publication.muted
    print("No microphone track found")
    return None
2. Share Device Details via Metadata
Copy code
import json

def share_device_info(participant):
    device_info = {
        "os": "Linux",
        "browser": "Chrome",
        "version": "112.0.0.0"
    }
    participant.set_metadata(json.dumps(device_info))
3. Process Received Metadata
Copy code
@room.on("participant_metadata_changed")
def on_metadata_changed(participant):
    metadata = json.loads(participant.metadata or "{}")
    print(f"Participant {participant.identity} is using {metadata.get('browser')} on {metadata.get('os')}")
If anything feels unclear or if you'd like me to walk you through more examples, please don't hesitate to ask. I'm here to help!