This guide explains how to set up and run a complete, end-to-end streaming demo using the Python Gateway Server connected directly to the Android Emulator's gRPC interface and the React frontend example application in js/example.
+-----------------+ +-----------------+ +-----------------+
| React Web | HTTP REST | Python Gateway | gRPC (TCP) | |
| Frontend App |--------------->| Server |--------------->| Android Emulator|
| (localhost:5173)| WS Signaling | (localhost:8080)| gRPC Rtc | |
| |===============>| |===============>| |
| | +-----------------+ +-----------------+
| | |
| | WebRTC Data & Media Streams |
| |<===========================================================|
+-----------------+ (UDP / SRTP)
Ensure you have a running emulator with the gRPC service enabled (either locally or inside a Docker container).
Locate the active emulator's discovery configuration file (ending in .ini):
- macOS default location:
~/Library/Android/avd/running/pid_<PID>.ini - Linux default location:
~/.android/avd/running/pid_<PID>.ini - Note: The file contains configuration properties such as
grpc.port=<port>andgrpc.token=<token>.
You can start the Python Signaling Gateway with a single command using the provided launch_video_demo.sh script:
- Navigate to the gateway directory:
cd gateway - Run the script, providing the path to the active emulator discovery
.inifile:./launch_video_demo.sh --discovery_file /path/to/pid_<PID>.ini
- In a separate terminal, launch the local React WebRTC frontend:
cd js/example npm install npm run dev - Open
http://localhost:5173in your browser.
The Python Gateway translates HTTP REST and WebSocket JSEP signaling into the emulator's native rtc2 gRPC protocol.
The gateway is configured as a standard Python package defined in pyproject.toml.
- Navigate to the
gatewaydirectory:cd gateway - Run the environment setup script to create a virtual environment and install dependencies:
./setup_env.sh
- Activate the virtual environment:
source venv/bin/activate - Start the gateway server:
videobridge-gateway \ --port=8080 \ --discovery_file=/path/to/pid_<PID>.ini
If dependencies (aiohttp, grpcio, google-protobuf) are already installed in your environment:
python3 src/videobridge_gateway/gateway_server.py \
--port=8080 \
--discovery_file=/path/to/pid_<PID>.iniVerify that the gateway server starts and binds successfully to http://localhost:8080.
You can connect using the local React example app or the hosted demo web app:
- Local App: Run
npm run devinjs/exampleand openhttp://localhost:5173. - Hosted App: Open https://pokowaka.github.io/android-emulator-webrtc/.
In the UI connection form:
- Set Emulator Gateway URI to
localhost:8080. - Click Connect to Emulator.
Once connected:
- The React app negotiates WebRTC SDP/JSEP offer-answer signaling via WebSocket over the gateway server.
- Video Streaming: The Android screen renders in real-time in your browser window.
- Control & Inputs:
- Touch/click and drag inside the emulator display to send touch gestures.
- Use hardware buttons (Home, Back, Volume, Power) to control the device.
- Send mock GPS location updates (latitude/longitude) via the controls panel.