I’m using the update permission feature to manage ...
# ask-ai
p
I’m using the update permission feature to manage subscribe permissions for a waiting room. However, when I update these permissions, participants only receive the tracks after the publisher takes an action, such as publishing their microphone, instead of receiving them immediately. Do you have any advice on how to make this work instantly?
t
Thanks for reaching out, Yassine. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I understand how managing subscribe permissions can sometimes feel a bit tricky, especially when participants don’t receive tracks right away. When you use the update permission feature, if the permissions are set to restrict access by default, participants might not get the tracks immediately. To help with this, here are a couple of friendly tips: • If you want everyone to subscribe to any published track without any hassle, simply set
allParticipantsAllowed
to
true
. • For more detailed control, make sure the
setTrackSubscriptionPermissions
method clearly includes permissions for the participants and tracks you want. For example:
Copy code
localParticipant.setTrackSubscriptionPermissions(false, [
  { participantIdentity: 'p1', allTracksAllowed: true },
  { participantIdentity: 'p2', trackSids: ['audio'] }
]);
Just a heads-up: when both
allParticipantsAllowed
and
allTracksAllowed
are set to
false
, new tracks won’t automatically grant subscription permissions. You’ll need to update the permissions to include those new tracks. Please feel free to reach out if you’d like me to walk you through this or if you have any other questions—I’m here to help! Sources: Sources/LiveKit/Core/SignalClient.swift | pkg/rtc/uptrackmanager.go | Managing participants | LiveKit Docs | lib/src/proto/livekit_rtc.pb.dart | src/room/participant/LocalParticipant.ts
p
where i put this ?
t
Hi there! To manage track subscription permissions, you’ll want to use the
setTrackSubscriptionPermissions
method in your client-side code, right after the local participant has connected to the room and published their tracks. This method is called on the
localParticipant
instance. Here’s a quick example in JavaScript to give you an idea:
Copy code
localParticipant.setTrackSubscriptionPermissions(false, [
  { participantIdentity: 'p1', allTracksAllowed: true },
  { participantIdentity: 'p2', trackSids: ['audio'] }
]);
If you let me know which SDK you’re working with (like JavaScript, Swift, Kotlin, etc.), I’d be happy to share a more tailored example to help you out! Sources: Camera & microphone | LiveKit Docs | Runtime/Scripts/Proto/Ffi.cs | Runtime/Scripts/Room/Participant/LocalParticipant.cs | Multiplatform/Views/RoomView.swift | packages/livekit-rtc/src/proto/track_pb.ts
p
Is there another event to use? Because the participant has already published their track, and I manage the waiting room with subscription permissions. So when I change the access, it should be reflected to all participants immediately const tracks = allTracks.filter((track) => { return track.participant.permissions?.canSubscribe === true; });
t
When you update subscription permissions, the changes take effect right away, and participants get a
SubscriptionPermissionUpdate
signal. This then triggers a
TrackSubscriptionPermissionChanged
event in the client SDK, so you can respond instantly to the new permissions. For instance, you might want to listen for this event to update the UI dynamically or manage track subscriptions smoothly:
Copy code
room.on('TrackSubscriptionPermissionChanged', (event) => {
  console.log('Subscription permissions updated:', event);
  // Update your UI or logic here
});
If you'd like, I’m here to help with more details or examples tailored to your specific SDK—just let me know! Sources: src/room/participant/LocalParticipant.ts | pkg/rtc/room.go | protobufs/livekit_rtc.proto | lib/src/core/room.dart | livekit-android-sdk/src/main/java/io/livekit/android/events/ParticipantEven...