A high-performance live broadcasting app built with Next.js, featuring AI shopping agents, media pull/push, and host-promotion system. π₯
A high-performance live broadcasting app inspired by Whatnot, built with Agora's Real-Time Communication platform. This demo combines live video streaming, AI shopping agents, host-promotion system, and advanced media services into a single, powerful application.
The AI agent now supports Agora-managed presets so you no longer need vendor API keys. Set any of the following env vars to use presets:
ASR_PRESETβdeepgram_nova_2,deepgram_nova_3(or leave blank forares/key mode)LLM_PRESETβopenai_gpt_4o_mini,openai_gpt_4_1_mini,openai_gpt_5_nano,openai_gpt_5_miniTTS_PRESETβminimax_speech_2_6_turbo,minimax_speech_2_8_turbo,openai_tts_1
When a preset is set, the corresponding API key (OPENAI_API_KEY, MICROSOFT_TTS_API_KEY) is not needed. Leaving a preset blank falls back to the original env-var key mode.
Vendor-specific preset params:
- MiniMax:
TTS_MINIMAX_VOICE_ID,TTS_MINIMAX_SAMPLE_RATE - OpenAI TTS:
TTS_OPENAI_VOICE,TTS_OPENAI_SPEED - LLM:
LLM_TEMPERATURE,LLM_MAX_TOKENS,LLM_MAX_HISTORY(apply in both preset and key mode; fall back toOPENAI_TEMPERATURE/OPENAI_MAX_TOKENS/AI_AGENT_MAX_HISTORYif not set)
The AI Agent now joins the channel with a generated RTC+RTM token (when AGORA_APP_CERTIFICATE is set), matching the existing client-side token flow. If no certificate is configured, the agent falls back to tokenless mode.
- Host & Audience Roles: Start live broadcasts as a host or join as an audience member
- Screen Sharing: Hosts can share their screen with the audience
- Video & Audio Controls: Toggle camera and microphone on/off
- Real-time Presence: See who's online using RTM presence
- Live Shopping Assistant: Toggle AI agent mode to get real-time product descriptions and tagging
- Smart Product Recognition: AI listens to host speech and extracts product metadata
- Seamless Integration: Works alongside regular broadcasting
- Request to Join Stage: Audience members can request to be promoted to co-host
- Host Approval: Hosts see requests and can approve/deny them
- Self-Demotion: Promoted users can demote themselves back to audience
- Real-time Signaling: Uses RTM for instant promotion/demotion
- Pull external video streams (HLS/RTMP/MP4) into your channel
- Full Controls: Play, pause, volume adjustment, and seek position
- Perfect for showing product videos or external content
- Push your live stream to external platforms
- Support for YouTube, Facebook, or any RTMP destination
- Raw or transcoded modes available
- Connect OBS Studio or external encoders
- Get stream keys for professional broadcasting setups
- Bridge external tools with Agora RTC channels
- Group Chat: RTM-based chat for all participants
- Presence System: See who's online in real-time
- Name-based UIDs: Users set their display name which serves as their identity
- Node.js 18+
- Agora account with App ID and Certificate
- Agora REST API credentials (for Media Services and AI Agent)
- OpenAI API key (for Conversational AI Agent)
-
Clone and install dependencies:
npm install
-
Configure environment variables: Copy
env.exampleto.env.localand fill in your credentials:cp env.example .env.local
Required variables:
NEXT_PUBLIC_AGORA_APP_ID=your_agora_app_id AGORA_APP_CERTIFICATE=your_agora_certificate AGORA_CUSTOMER_ID=your_agora_customer_id AGORA_CUSTOMER_SECRET=your_agora_customer_secret OPENAI_API_KEY=your_openai_key
-
Run development server:
npm run dev
This starts Next.js development server at
http://localhost:3000 -
Build for production:
npm run build
- Connect your repository to Netlify
- Set environment variables in Netlify dashboard:
- Go to Site settings β Environment variables
- Add all variables from your
.envfile
- Deploy: Netlify will automatically build and deploy
The netlify.toml file is already configured with:
- Build command:
npm run build - Publish directory:
.next - Next.js plugin:
@netlify/plugin-nextjs(handles routing automatically)
- Pages:
app/browse/,app/host/,app/watch/,app/broadcast/[channelName]/ - Components: Reusable React components in
app/components/ - Services:
src/services/agoraService.js- Unified service for RTC/RTM operations
app/api/token/: Generates secure RTC/RTM tokensapp/api/channels/: Fetches active Agora channelsapp/api/media-proxy/: Proxies Agora REST API calls (keeps credentials secure)app/api/agora-agents/: Manages Conversational AI Agent lifecycle
- Agora RTC SDK: Real-time video/audio communication
- Agora RTM SDK 2.x: Real-time messaging and presence
- Agora Media Services: Pull, Push, and Gateway
- Agora Conversational AI: Live shopping assistant
- React + Tailwind CSS: Modern, responsive UI
- Enter your name and room name on the lobby page
- Click "Start Hosting"
- Allow camera/microphone permissions
- Your broadcast is now live!
Host Controls:
- Toggle AI Agent on/off
- Share screen
- Promote audience members to co-host
- Use Media Pull to inject external videos
- Use Media Push to stream to YouTube/Facebook
- Use Media Gateway to connect OBS
- Enter your name and room name
- Click "Join Room"
- Watch the broadcast and interact via chat
- Request to join stage if you want to co-host
Audience Features:
- Real-time chat
- Request promotion to stage
- View host video and screen shares
- Picture-in-picture support
- Go to Media tab β Pull
- Enter video URL (supports RTMP, HLS, MP4)
- Click "Start Media Pull"
- Use controls to play/pause, adjust volume, or seek
- Go to Media tab β Push
- Enter RTMP URL (from YouTube/Facebook/other)
- Click "Start Push"
- Your stream is now broadcasting to the external platform
- Go to Media tab β Gateway
- Click "Create Gateway Stream"
- Copy the stream key and server URL
- Use in OBS or other external encoder
- Ensure all dependencies are installed:
npm install - Check that environment variables are set correctly
- Verify Node.js version is 18+
- Verify Agora App ID and Certificate are correct
- Check network connectivity
- Ensure browser permissions for camera/microphone
- Verify REST API credentials are set
- Check that your Agora project has Media Services enabled
- Ensure proper permissions for Media Services API
MIT
Built with Agora.io Real-Time Communication Platform