Use this project to create a Python server or client for live video and audio streaming applications compatible with the Unity Asset "WebRTC Video Chat" (available on Unity Asset Store) or awrtc_browser (github).
Install all pip modules via:
pip install -r requirements.txt
Then copy example_.env
to .env
and change the URLs to your own servers if needed.
The default values will use a free test server shared with Unity and browser side exampes.
To learn how to set up the signaling server, see:
- awrtc_signaling github
- awrtc_signaling for docker: awrtc_signaling_docker
To run a first test, open two terminal windows and run:
In terminal 1:
python call_app.py -l test1234 --video --audio
In terminal 2:
python call_app.py test1234
The first app will now stream a dummy video feed to the second. The second will playback video and audio received.
To stream from/to the browser, run the following in the terminal:
python call_app.py -l test1234 --video --audio
To connect to the browser open the Browser CallApp Example and press join or build your own via the (awrtc_browser github). Note signaling server can only be changed if rebuild via github (change the URI here).
- Open the scene
callapp/callscene
- Press Start
- Enter
test1234
into the text field - Press Join
The signaling server can be changed via the Unity Editor by clicking on the CallApp object and changing the signaling server URL in the inspector.
Wait for another user to connect and then send video from a file:
python call_app.py -l test1234 --from-file your_video.mp4
Save incoming audio and video to a file (will overwrite files without warning!):
python call_app.py -l test1234 --to-file out_video.mp4
On mac you might need to install portaudio for the setup process to work. This can be done via brew:
brew install portaudio
#then reinstall pip modules
pip install -r requirements.txt