Instant Voice
This demo showcases how to enable instant voice communication as soon as a user connects. By leveraging optimizations on both the server and client sides, users can start speaking immediately after pressing the connect button.
How It Works
Server-Side Improvements:
- A pool of Daily rooms is managed to ensure quick connections.
- When a user connects, an existing room from the pool is assigned.
- A new room is created asynchronously to maintain the predefined pool size.
Client-Side Improvements:
- Using the DailyTransport property
bufferLocalAudioUntilBotReadyset to enabled, users can start speaking immediately upon receiving theAUDIO_BUFFERING_STARTEDevent (typically within ~1s). - This allows users to speak even before the bot is fully ready or the WebRTC connection is fully established.
Quick Start
1. Start the Bot Server
- Navigate to the server directory:
cd server - Create and activate a virtual environment:
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate - Install dependencies:
pip install -r requirements.txt - Copy the
.env.examplefile to.envand configure it:- Add your API keys.
- Start the server:
python src/server.py
2. Connect Using the Client App
For client-side setup, refer to the JavaScript Guide.
Important Notes
- The bot server must be running before using the client implementation.
- Ensure your environment variables are correctly set up.
Requirements
- Python 3.10+
- Node.js 16+ (for JavaScript/React client)
- Daily API key
- Google API key
- Modern web browser with WebRTC support