<@U084APK40NS> When a participant's `canPublish` p...
# ask-ai
g
@millions-hair-24956 When a participant's
canPublish
permission is updated via the nodejs server, I run this code on the android client,
Copy code
is ParticipantEvent.ParticipantPermissionsChanged -> {
   if (event.newPermissions?.canPublish == true) {
      localParticipant?.setMicrophoneEnabled(true)
      localParticipant?.setCameraEnabled(isVideoAllowed)
   }
}
and yet I can't hear the updated participant, only the host who started the room. What could be wrong?
g
It seems likely that the issue might be related to the way permissions and track subscriptions are being handled on the client side. According to the LiveKit documentation, when a participant's permissions change, the
ParticipantPermissionsChanged
event should trigger updates to the participant's ability to publish tracks. However, if you are unable to hear the updated participant, it might be due to the tracks not being properly subscribed to or enabled after the permission change. To troubleshoot, ensure that the tracks are being subscribed to correctly after the permission update. You might need to explicitly subscribe to the participant's tracks if they are not automatically subscribed. Additionally, verify that the participant's audio track is enabled and not muted. If the issue persists, consider checking the server-side logic to ensure that the permission updates are being correctly propagated to the client. Would you like more detailed guidance on how to handle track subscriptions or permissions in LiveKit? Sources: - LiveKit documentation 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.
g
@millions-hair-24956 Neither
ParticipantEvent.LocalTrackPublished
nor
RoomEvent.TrackPublished
on the other participant's end is getting fired after calling
localParticipant?.setMicrophoneEnabled(true)
. Why is that?
@millions-hair-24956 Neither
ParticipantEvent.LocalTrackPublished
nor
RoomEvent.TrackPublished
on the other participant's end is getting fired after calling
localParticipant?.setMicrophoneEnabled(true)
. Why is that?
g
It seems likely that the issue might be related to the track not being properly published or the event listeners not being set up correctly. According to the LiveKit documentation, the
LocalTrackPublished
event should be triggered when a local track is successfully published. If this event is not firing, it could be due to several reasons: 1. Track Publishing: Ensure that the track is being published successfully. Check if there are any errors or exceptions when calling
setMicrophoneEnabled(true)
. The track might not be published if there are issues with permissions or device access. 2. Event Listeners: Verify that the event listeners for
ParticipantEvent.LocalTrackPublished
and
RoomEvent.TrackPublished
are correctly set up and registered before the track is published. If the listeners are not active, the events will not be captured. 3. Permissions: Ensure that the participant has the necessary permissions to publish tracks. If the
canPublish
permission is not set correctly, the track will not be published. 4. Network Issues: Check for any network connectivity issues that might prevent the track from being published to the server. Would you like more detailed guidance on setting up event listeners or troubleshooting track publishing in LiveKit? Sources: - https://livekit-users.slack.com/archives/C07FYCB7FRQ/p1728674567.746139 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.