Supported Codecs
- H264, VP8, VP9 video codecs.
- Opus audio codec.
Supported Servers
WebRTC Streaming Configuration
Publisher Configuration
To enable a player as a publisher set the player needs the publisher
config enabled.
{
"rtc": {
"publisher": true
}
}
Configuring stream name and server application
{
clip: {
"live": true,
"sources": [
{ "type": "application/webrtc", "src": "myStream", "appName": "webrtc"}
]
}
}
Server Configuration
The server
config, sets up WebRTC connectivity with a particular server.
- antmedia
- wowza
- kurento
- millicast
- antmedia-conference
- wowza-conference
- kurento-conference
- millicast-conference
Options
Here is a list of the configuration options:
Property | Description | Default |
---|---|---|
publisher | Enable the player as the publisher. Which enables the full WebRTC encoder publishing application. | false |
serverURL | The host of the websocket service. For Wowza the url is configured from the host. | |
userData | Custom data to send to the Wowza server. This can be used in the custom websocket for authentication. | |
server | The server type. For conferencing, configure with the postfix -conference. | wowza |
debug | Turns on full peer connection debug logging. | false |
prefferedCodecs | A codecs filter for the preferred codec. For Wowza H264 requires a level filter. | { |
"audio": { | ||
"codec": "opus", | ||
}, | ||
"video": { | ||
"codec": "H264", | ||
"level": "42e01f" | ||
} | ||
} | ||
opus | Opus codec configs | |
ui | CSS selectors for managing external select menus with data and control of WebRTC and media options. Disable this if using external controls with the device data provided. | { |
"audioInput": "audioSource", | ||
"audioOutput": "audioOutput", | ||
"videoSource": "videoSource", | ||
"bandwidth": "bandwidth", | ||
"resolution": "resolution", | ||
"rates": "rates", | ||
"container": "#encoder-menu" | ||
} | ||
dataCallback | To manage the encoder controls externally, the device data is provided in this callback to build the device menus. And return with the configured options. | |
autoStartDevice | Enable to auto activate the device on initialisation. Or turned on when clicking the player. | false |
maxBitrateBitrate | Configure an initial max bitrate bitrate. This is required for Chrome to function with Wowza. | 2000 |
minVideoBitrate | Minimum video bitrate. Used on Chrome only. Wowza requires it to be the max bitrate. | 2000 |
startVideoBitrate | Starting video bitrate. Used on Chrome only. | 300 |
audioVideoBitrate | Audio codec bitrate. | 64 |
recording | Enable recording of the local stream with a download option. Config requires the filename for the download and the mimetype and codec. For H264 use video/mp4 and H264 as the codec. | |
pcConstraints | Set browser specific Peer connection options. | |
toggleScreen | Enable camera / share screen switching features. | false |
floatedControls | Move all the controls buttons to underneath the player. | false |
Peer Connection Options
{
"optional": [
{ "googIPv6": true },
{ "googImprovedWifiBwe": true },
{ "googDscp": true },
{ "googSuspendBelowMinBitrate": true },
{ "googScreencastMinBitrate": 300 },
{ "googCombinedAudioVideoBwe": true },
//turn off resolution changes
{ "googCpuOveruseDetection": false },
{ "googCpuOveruseEncodeUsage": false },
{ "googCpuUnderuseThreshold": 55 },
{ "googCpuOverUseThreshold": 85 }
]
}
Enable Stream Recording
{
"mimeType": "video/webm",
"codec": "VP9",
"name": "recording1"
}
WebRTC Group Call Conferencing Options
Property | Description | Default |
---|---|---|
roomName | Required for Kurento and Millicast group call conferencing. | |
conferenceContainer | The container selector to host the remote participant's stream in a player. | |
hlsTemplate | When using Wowza. The HLS url template to use when subscribing in a group call as HLS. | https:// |
conferenceSubscribeHls | Set to true to subscribe to remote participants in a group call as HLS instead of WebRTC. | |
peerSubscribe | Required for Kurento group call conferencing. |
Subscriber Options
Property | Description | Default |
---|---|---|
serverURL | The host of the websocket service. For Wowza the url is configured from the host. | |
server | The server type. For now Wowza is supported with other signalling servers after. | wowza |
userData | Custom data to send to the Wowza server. | |
debug | Turn on internal peering logs. | false |
Millicast Options
{
"millicast": {
"accountId": "",
"publishToken": "",
"subToken": ""
}
}
Property | Description | Default |
---|---|---|
accountId | Millicast account id shown in the api key section. | |
publishToken | The publishing token created in the api section. This is used for generating the signal server url unless supplied using serverURL | |
subToken | Subscriber token generated by the backend using the secret key and Millicast api. This is used when authenticated subscriber is enabled for the publish token. | |
userData | Custom data to send to the Wowza server. | |
debug | Turn on internal peering logs. | false |
Virtual Background Removal Plugin Options
Property | Description | Default |
---|---|---|
renderType | The background rendering type. Either bodypix, or Chromakey | bodypix |
backgroundType | If Chromakey rendering is set. Choose from either Green Screen colour detection or auto for solid colour backgrounds. | green |
backgroundColor | Specify the background colour in an rgb value array. | [0, 255, 0] |
accurate | Use the fast or slow Bodypix architecture config. Slow is more accurate but more intensive. | false |
internalResolution | The resolution for segmenting the detected body from the background. Medium or high. | medium |
segmentationThreshold | An accuracy threshold for segmentation. | 0.5 |
fast | The fast least accurate Bodypix config. | { |
"architecture": 'MobileNetV1', | ||
"outputStride": 16, | ||
"multiplier": 0.75, | ||
"quantBytes": 2 | ||
} | ||
slow | The slow more accurate Bodypix config. | { |
"architecture": 'ResNet50', | ||
"outputStride": 16, | ||
"multiplier": 1, | ||
"quantBytes": 2 | ||
} |
Ant Media Server WebRTC Configuration
SSL is required to be configured for WebRTC to function. Ant Media supplies a helper script to import an SSL certificate and private key into the server host configs.
Documentation for SSL setup.
For Letsencrypt SSL configuration , the helper script generates this internally. This requires port 80 external access for the verification server.
sudo ./enable_ssl.sh -d example.com
If the verification server is inaccessible. A DNS verification is possible to be imported into the script. Letsencrypt scripts are supplied for generating these certificates.
certbot -d example.com -m email@example.com --manual --preferred-challenges dns certonly
Import external generated certificates
sudo ./enable_ssl.sh -f yourdomain.crt -p yourdomain.key -c yourdomainchain.crt -d yourdomain.com
Wowza WebRTC Configuration
Provided is a set of example configs for wowza with install script to get the WebRTC signal server working. Provided is a script to convert PEM SSL certificates into JKS format for Wowza.
An SSL certificate is required to be configured into the Secure SSL provider config inside VHost.xml.
The Websocket provider also needs to be configured inside VHost.xml
Enable Wowza Websocket
Enabled within the SSL host within the VHost.xml
<HTTPProvider>
<BaseClass>com.wowza.wms.webrtc.http.HTTPWebRTCExchangeSessionInfo</BaseClass>
<RequestFilters>*webrtc-session.json</RequestFilters>
<AuthenticationMethod>none</AuthenticationMethod>
</HTTPProvider>
Enable Custom Wowza Websocket
Provided is a custom websocket Wowza project to enable stream authentication.
<HTTPProvider>
<BaseClass>org.electroteque.webrtc.HTTPProviderGroupCallWebSocket</BaseClass>
<RequestFilters>*webrtc-room-session.json</RequestFilters>
<AuthenticationMethod>none</AuthenticationMethod>
</HTTPProvider>
Wowza WebRTC Conferencing Configuration
To enable the conferencing examples. The supplied WebRTCCustomSignalServer Wowza IDE project, needs to be imported and built to be configured and loaded.
This provides the custom WebRTC signal server for WebRTC publishing with token protection. Another WebSocket provider is for group call signal messaging and to notify when a WebRTC publish begins.
<HTTPProvider>
<BaseClass>org.electroteque.webrtc.HTTPWebRTCExchangeSessionInfoCustom</BaseClass>
<RequestFilters>*webrtc-session.json</RequestFilters>
<AuthenticationMethod>none</AuthenticationMethod>
</HTTPProvider>
<HTTPProvider>
<BaseClass>org.electroteque.webrtc.HTTPProviderGroupCallWebSocket</BaseClass>
<RequestFilters>*webrtc-room-session.json</RequestFilters>
<AuthenticationMethod>none</AuthenticationMethod>
</HTTPProvider>
Millicast WebRTC Configuration
In the Millicast console. A streamname is required to be added. This will generate a publish key. A wildcard asterix can be used to link a publish key to any stream name. Click the Token Required
next to the Secure Viewer
section. This turns on token authentication for subscribers.
After adding a stream. A Publish key and Account ID is displayed to configure the publisher and subscriber with.
Generating Subscriber Token
Using the Millicast API. A subscriber token can be generated with domain restriction. This requires the Secret Key which is different to the Publish Key. A helper script is supplied to generate these tokens and test the tokens work with the api.
curl -H "Authorization: Bearer secretkey" -H "Content-Type: application/json" https://api.millicast.com/api/subscribe_token -d '{"label": "LiveStreamLabel", "streams": [{"streamName": "StreamName"}], "allowedOrigins": ["*.domain.com"]}'
Kurento WebRTC Configuration
Kurento Media Server comes in two parts. The Kurento Media Server and a java / node JSONRPC client WebSocket server.
Provided is a one to many application aswell as a group call application to run the group call example.
The one to many application endpoint is one2many
The group call application endpoint is groupcall
Start the Kurento server first with
export MAKEFLAGS="-j$(nproc)"
./bin/kms-build-run.sh
Start the Kurento client Websocket server with
mvn -U clean spring-boot:run -Dkms.url=wss://localhost:8433/kurento