better-gigabyte-88039
07/30/2025, 2:01 PMtall-airline-16756
07/30/2025, 2:01 PMtall-airline-16756
07/30/2025, 2:02 PM// Enables the microphone and publishes it to a new audio track
room.localParticipant.setMicrophoneEnabled(true);
When you call setMicrophoneEnabled(true), it will immediately trigger the microphone permission prompt and start publishing audio once the user grants permission.
Additionally, you can enable the microphone with options like pre-connect buffering:
room.localParticipant.setMicrophoneEnabled(true, undefined, {
preConnectBuffer: appConfig.isPreConnectBufferEnabled,
});
While you can call this method immediately after connecting to the room or even before connecting, the browser's permission prompt cannot be bypassed.
Sources: Publishing tracks | LiveKit Docs | web/providers/GameProvider.tsx | Voice Assistants | livekit/livekit_composite | DeepWiki | components/playground.tsx | complex-agents/nova-sonic/nova-sonic-form-agent/components/app.tsx