Pause/Resume Call
Control the conversation flow by pausing and resuming the microphone and audio processing.
Pause Call
Temporarily pause the conversation to stop listening and speaking:
import { Micdrop } from '@micdrop/web'
// Pause the call - stops microphone and mutes speakerMicdrop.pause()
console.log('Call paused:', Micdrop.isPaused) // trueWhen paused:
- ⏸️ Microphone stops recording
- ⏸️ No audio is sent to the server
- ⏸️ Incoming audio is muted
- ⏸️ Send event to server to stop processing
- ✅ Voice activity detection stays enabled
- ✅ WebSocket connection remains active
Resume Call
Resume the conversation to continue listening and speaking:
// Resume the call - restarts microphone and unmutes speakerMicdrop.resume()
console.log('Call paused:', Micdrop.isPaused) // falseconsole.log('Now listening:', Micdrop.isListening) // trueWhen resumed:
- ✅ Microphone starts recording again
- ✅ Audio processing continues
- ✅ Incoming audio plays normally
State Monitoring
Monitor pause/resume state changes:
Micdrop.on('StateChange', (state) => { if (state.isPaused) { console.log('🔇 Call is paused') // Update UI to show paused state updateStatus('Paused - Click to resume') } else if (state.isListening) { console.log('🎤 Call resumed - Listening...') // Update UI to show active state updateStatus('Listening for your voice') }})UI Integration
Create pause/resume controls in your interface:
// Button handler for pause/resume togglefunction togglePause() { if (Micdrop.isPaused) { Micdrop.resume() document.getElementById('pauseBtn').textContent = 'Pause' } else { Micdrop.pause() document.getElementById('pauseBtn').textContent = 'Resume' }}React example:
import { useMicdropState } from '@micdrop/react'
function CallControls() { const state = useMicdropState()
return ( <button onClick={state.isPaused ? Micdrop.resume : Micdrop.pause}> {state.isPaused ? '▶️ Resume' : '⏸️ Pause'} </button> )}