Skip to main content

Dependencies

Add these packages to your pubspec.yaml:

1. Fetch Session Token

Call the token endpoint with your API key.

2. Connect WebSocket

Open the WebSocket and send the token as the first message. Handle text (JSON control) and binary (PCM audio) messages separately.

3. Microphone Capture

Use the record package to capture PCM audio and buffer it into exact 640-byte frames.

4. Audio Playback

Use flutter_sound to play raw PCM audio received from the WebSocket.

5. Putting It All Together

6. Platform Setup

Android

Request runtime permission before starting mic capture:

iOS

The flutter_sound package handles AVAudioSession configuration automatically.