startTrackSubscriptionWatcher

fun startTrackSubscriptionWatcher(room: Room, scope: CoroutineScope, participantIdentity: String? = null, trackName: String? = null, onSubscribed: (track: Any, participant: RemoteParticipant, publication: TrackPublication) -> Unit, manualSubscribe: (publication: TrackPublication) -> Unit? = null): Job

Start watching the Room for publications that match the target participant identity and/or track name. Calls onSubscribed when a subscribed Track instance is available for the matching publication.

The helper will also scan existing remote participants/publications immediately when started.

Parameters

room

LiveKit Room instance

scope

CoroutineScope to launch the watcher in (e.g., viewModelScope)

participantIdentity

optional participant.identity to match (null = any participant)

trackName

optional publication.name or trackSid to match (null = any track)

onSubscribed

callback invoked with the concrete track object, the publisher and the publication

manualSubscribe

optional lambda that will be called for a matching publication when the SDK hasn't produced a Track instance yet (publication.track == null). Use this to perform any SDK-specific manual subscribe call. If null, the helper will not attempt manual subscription.