Microphone Controls
rooomSpaces Viewer API microphone management for multiplayer virtual environments. Control voice chat, audio input, and communication features in 3D virtual spaces.
Are you an LLM? You can read better optimized documentation at /docs/rooom-spaces/viewer/viewer-api/microphone.md for this page in Markdown format
setMicrophoneMuteState
setMicrophoneMuteState(mute: boolean, [callback: Function])
Controls the mute state of the user's microphone for voice communication in the virtual space. This affects voice chat with other users in multiplayer environments.
Parameters:
mute: boolean-trueto mute the microphone,falseto unmute
js
// Mute the microphone
api.setMicrophoneMuteState(true, function(){
console.log('Microphone muted');
});
// Unmute the microphone
api.setMicrophoneMuteState(false, function(){
console.log('Microphone unmuted');
});isMicrophoneMuted
isMicrophoneMuted([callback: Function])
Returns the current mute state of the user's microphone. Use this to synchronize UI elements and check communication status.
js
api.isMicrophoneMuted(function(isMuted){
console.log('Microphone muted:', isMuted); // true/false
});Best Practices
Privacy First:
- Always start with microphone muted by default
- Provide clear visual indicators of microphone state
- Allow users to easily toggle microphone on/off
User Experience:
- Use clear visual and audio cues for microphone state
- Provide keyboard shortcuts for quick mute/unmute
- Consider push-to-talk functionality for better control
Multiplayer Considerations:
- Respect user privacy preferences
- Provide individual volume controls for other users
- Consider spatial audio for realistic voice positioning