LocalAudioStream interface

extends AudioStream  LOCAL

Your microphone stream. Adds device control and silence detection. Access via room.localParticipant.audio after publishAudio(). Frame processors are managed globally via VideoSDK.applyAudioProcessor() โ€” not on the stream.

Blueprint

Members added on top of AudioStream.

interface LocalAudioStream extends AudioStream { // Device identity (typed object, not just an id) readonly inputDevice: MicrophoneDeviceInfo; // Device control setInputDevice(device: MicrophoneDeviceInfo): Promise<void>; getInputCapabilities(): Promise<AudioCapabilities>; // Lifecycle โ€” PRE-CALL only: abort the preview before join. // Releases the mic, clears VideoSDK.audioStream singleton slot. // Post-join: use me.unpublishAudio() for full teardown (unpublish + release device). stop(): Promise<void>; // === Events fired === // 'silent-detected' ({ timestamp }) โ€” local mic gone silent (hardware mute, dead device) // 'ended' ({ timestamp }) โ€” mic source ended (unplugged, permission revoked) // No setVolume / audioLevel โ€” those live on RemoteAudioStream }
No setVolume / audioLevel here โ€” those live on RemoteAudioStream. You don't control the volume of your own outgoing mic at the SDK level. For local-side speaking-level UI, use getStats() or compute via Web Audio analyser through getMediaStreamTrack().

Properties (added)

Plus inherited from AudioStream: id, codec, isPlaying, isMuted, isEnded.

inputDevice

Currently selected microphone as a MicrophoneDeviceInfo (combines deviceId, groupId, label). Use me.audio.inputDevice.label for "Mic: X" UI; me.audio.inputDevice.deviceId for storage / comparison.

readonly inputDevice: MicrophoneDeviceInfo

Methods (added)

Plus inherited from AudioStream: attach / detach, getStats, getMediaStreamTrack.

setInputDevice async

Hot-swap to a different microphone. Stream instance preserved; SDK swaps the underlying track. Strongly typed โ€” passing a CameraDeviceInfo or SpeakerDeviceInfo is a compile-time error.

setInputDevice(device: MicrophoneDeviceInfo): Promise<void>
Example โ€” switch to USB headset mic
const mics = await VideoSDK.getMicrophones();
const headset = mics.find(m => m.label.includes('Headset'));
await me.audio.setInputDevice(headset);
Processors live on VideoSDK, not on the stream. v1 uses a sticky global processor model โ€” call VideoSDK.applyAudioProcessor() to apply a frame transform. It survives publish, unpublish, re-publish, and setInputDevice swaps. No per-stream setProcessor method.

getInputCapabilities async

Reports what the current mic can do โ€” sample rates, channel counts, etc.

getInputCapabilities(): Promise<AudioCapabilities>

stop async PRE-CALL

Aborts a pre-call preview stream. Releases the underlying microphone and clears the VideoSDK.audioStream singleton slot. After stop(), all methods on this instance throw STREAM_STOPPED.

stop(): Promise<void>
Pre-call only. Once VideoSDK.join auto-promotes this stream into me.audio, use me.unpublishAudio() instead โ€” it does full teardown (unpublish + release device).

Related open questions: Q18 โ€” Pre-call preview lifecycle (singleton vs render-only)

Events

There are no publish/unpublish events on LocalParticipant โ€” the publishAudio Promise delivers the stream directly.

EventPayloadWhen
silent-detected{ timestamp: number }Local mic gone silent (hardware mute, dead device, mic permission revoked, OS sleep).
ended{ timestamp: number }Mic source ended โ€” device unplugged, OS revoked permission, browser tab lost device access.

No paired active event โ€” silence is the abnormal state worth flagging; "active" is the default and not interesting to notify on.

Decoder-side states (frozen / stuck) are scoped to RemoteVideoStream only. RemoteAudioStream exposes a single state-changed event for routing transitions (active / paused / ended).
Example โ€” silence warning UI
await me.publishAudio({ deviceId: 'default', noiseSuppression: true });

me.audio.on('silent-detected', ({ timestamp }) => {
  showToast("Your microphone isn't picking up sound. Check that it's not muted on your device.");
});

See also: AudioStream LocalParticipant AudioFrameProcessor RemoteAudioStream