WebRTC Settings
Description
This module creates a video stream of the X-Creator that can be received in a web browser via WebRTC.
X-Creator Configuration
The WebRTC module only needs to be enabled in the X-Creator settings for the X-Creator that should provide the stream. The module is always enabled when the X-Creator is running and cannot be disabled in the X-Creator UI.
Custom Resolution
Enables to set a custom resolution that is used for streaming the X-Creator. Make sure to enter a resolution with the same aspect ratio as the application so the image of the stream is not stretched.
Stream Audio
Adds the audio output of the X-Creator to the stream. Be aware that only audio and video layers are supported if Media Foundation is selected for video playback.
Bitrate
Set the minimum and maximum bitrate used for encoding the video stream (in Mbit). For a good image quality a value around 10Mbit should be set for the maximum bitrate.
Website Port
The port on which the website that shows the WebRTC stream can be reached. Must be set to the same port that is used when starting the X-WebRTC server that hosts the website.
X-WebRTC Server
To be able to receive the WebRTC stream in a web browser the X-WebRTC server has to be started on the machine that runs the X-Creator with the WebRTC module enabled. This server acts as the signaling server and handles the communication between the web browser and the X-Creator and provides a website for displaying the stream.
Command line parameters for the server:
-p (optional)
By default the port 8080 is used for the website. If this port is not available this parameter can be used to specify another one (e.g. -p 8123
)
Configuration
An .env
file can be used to configure the server as well. The port of the server and a special fullscreen mode can be set. When setting FULLSCREEN=true
the video player switches to fullscreen automatically when clicking the play button. In this mode the application bar of the window and the address bar of the web browser stay visible. This mode is only recommended if the default fullscreen mode cannot be used. By default (FULLSCREEN=false
) a fullscreen button is shown within the video player that can be used to swith to fullscreen. In the default fullscreen mode the whole screen is covered by the video player.
Default configuration:
PORT=8080
FULLSCREEN=false
The configuration file has to be placed next to the executable or next to the ServiceInstaller.xml
file in case of installing it as a Windows Service.
Windows Service
The X-WebRTC Server can be installed as a Windows Service so it is automatically started with the system. Just copy the WebRTCService
folder containing the necessary files next to the executable of the server and set the following values in the file ServiceInstaller.xml
:
executable
Set the absolute path to the executable of the server which will be used by the service.
startarguments (optional)
If the port of the server needs to be changed it can be set here the same way as on the command line, e.g. -p 8082
. The service needs to be uninstalled first if the port has to be changed.
After the values are set the Batch scripts that are provided next to the XML file can be used to install, uninstall, start, stop, restart and show the current status of the service. When the service is installed it can be found in the Windows Services application under the name which was entered in the ServiceInstaller.xml
and also started and stopped from there.
Tools
In the Chrome browser the WebRTC session can be inspected via chrome://webrtc-internals
. There you can see things like the codec used, the video resolution, frames received/decoded per second, received bitrate etc.
Additional Information
Further technical information can be found in the documentation of the Unity packages that are used: