powerful-kite-32354
08/03/2025, 4:56 PMon_user_turn_completed callback using the STT node wrapper—everything worked perfectly.
Now I want to handle both tracks in the same callback, but differentiate them so I can prefix each user turn with an identifier (e.g. “MICROPHONE” or “SYSTEM_AUDIO”). On the subscriber side, I’m listening for the track_subscribed event and I can ensure that both tracks are received:
def on_track_subscribed(
track: rtc.RemoteTrack,
publication: rtc.RemoteTrackPublication,
participant: rtc.RemoteParticipant
):
if track.kind != rtc.TrackKind.KIND_AUDIO:
return
print(f"DEBUG: Track: {track}, Publication: {publication}, Participant: {participant}")
if publication.source == rtc.TrackSource.SOURCE_MICROPHONE:
speaker = "MICROPHONE"
elif publication.source == rtc.TrackSource.SOURCE_SCREENSHARE:
speaker = "SYSTEM_AUDIO"
else:
speaker = participant.identity
print(f"DEBUG: Speaker: {speaker}, Source: {publication.source}")
My question: what’s the most straightforward way to identify each track’s source inside the on_user_turn_completed callback? Any pointers or examples would be hugely appreciated!
Thanks in advance!powerful-kite-32354
08/06/2025, 10:17 AMjolly-air-155
08/07/2025, 7:11 AM