A clean, professional web application for real-time voice conversations with your custom AI avatar.
- Real-time Voice Chat: Automatic voice detection with 2-4 second response times
- Text Input: Type messages for your avatar to speak
- Beautiful UI: Glass-morphism design with smooth animations
- Mobile Responsive: Works perfectly on all devices
- Error Handling: Graceful fallbacks and user-friendly error messages
-
Install Dependencies
npm install
-
Set Up Environment Variables Create a
.envfile with your API credentials:VITE_HEYGEN_API_TOKEN=your-api-token-here VITE_HEYGEN_AVATAR_ID=your-avatar-id VITE_HEYGEN_VOICE_ID=your-voice-id
-
Start Development Server
npm run dev
-
Open in Browser Navigate to
http://localhost:5173/
ai-streaming-app/
├── src/
│ ├── avatar-manager.js # AI Avatar SDK wrapper with event handling
│ ├── ui-controller.js # UI state management and interactions
│ ├── main.js # Application entry point
│ └── style.css # Beautiful CSS with animations
├── index.html # Clean HTML structure
├── .env # Environment configuration
└── package.json # Dependencies and scripts
- Beautiful gradient background with avatar preview
- Single "Start Conversation" button to initialize
- Live avatar video stream
- Automatic voice detection (no push-to-talk needed)
- Text input with character counter
- Real-time status updates
- Uses modern streaming avatar SDK
- Handles stream setup and video display
- Manages voice chat lifecycle
- Error recovery and reconnection
Your avatar configuration is set via environment variables:
VITE_HEYGEN_API_TOKEN: Your API tokenVITE_HEYGEN_AVATAR_ID: Your custom avatar IDVITE_HEYGEN_VOICE_ID: Your voice model ID
- Glass-morphism UI: Modern translucent design elements
- Animated Gradient Background: Dynamic color shifting
- Responsive Layout: Mobile-first design approach
- Visual Feedback: Speaking indicators and loading states
- Accessibility: ARIA labels and keyboard navigation
Built with:
- Vite: Fast build tool and dev server
- Vanilla JavaScript: No framework complexity
- Modern CSS: Custom properties and animations
- Streaming Avatar SDK: Latest AI avatar technology
- Click "Start Conversation" to initialize your avatar
- Wait for connection (usually 2-3 seconds)
- Just speak naturally - automatic voice detection
- Or type messages in the text area
- Watch your avatar respond in real-time!
Connection Issues: Check your API token and internet connection
Voice Not Working: Ensure microphone permissions are granted
Avatar Not Loading: Verify your avatar ID is correct
Build Errors: Run npm install to update dependencies
Premium Streaming: Requires paid plan for full SDK access
- Real-time streaming with custom integration
- No watermarks with paid plans
- Full voice chat functionality
Embed Fallback: Works with free accounts
- Uses hosted embed iframe
- May include branding on free plans
- Still supports voice chat through web interface
- Upgrade to paid plan
- Click "Start Conversation"
- Enjoy full streaming functionality without watermarks
- Click "Try Embed Version" on landing page
- Or click the fallback button if streaming connection fails
- Interact with avatar through embed interface
Built following modern web development best practices for production-ready deployment.