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
  • kinesisvideo
  • ovenmedia
  • antmedia-conference
  • wowza-conference
  • kurento-conference
  • millicast-conference

Options

Here is a list of the configuration options:

PropertyDescriptionDefault
publisherEnable the player as the publisher. Which enables the full WebRTC encoder publishing application.false
serverURLThe host of the websocket service. For Wowza the url is configured from the host.
userDataCustom data to send to the Wowza server. This can be used in the custom websocket for authentication.
serverThe server type. For conferencing, configure with the postfix -conference.wowza
debugTurns on full peer connection debug logging.false
prefferedCodecsA codecs filter for the preferred codec. For Wowza H264 requires a level filter.{
"audio": {
"codec": "opus",
},
"video": {
"codec": "H264",
"level": "42e01f"
}
}
opusOpus codec configs{ "stereo": 1 }
uiCSS 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"
}
dataCallbackTo manage the encoder controls externally, the device data is provided in this callback to build the device menus. And return with the configured options.
autoStartDeviceEnable to auto activate the device on initialisation. Or turned on when clicking the player.false
maxBitrateBitrateConfigure an initial max bitrate bitrate. This is required for Chrome to function with Wowza.2000
minVideoBitrateMinimum video bitrate. Used on Chrome only. Wowza requires it to be the max bitrate.2000
startVideoBitrateStarting video bitrate. Used on Chrome only.300
audioVideoBitrateAudio codec bitrate.64
recordingEnable 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.
pcConstraintsSet browser specific Peer connection options.
toggleScreenEnable camera / share screen switching features.false
floatedControlsMove all the controls buttons to underneath the player.false
transportTcpEnable TCP transport for OvenMediaEnginefalse

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

PropertyDescriptionDefault
roomNameRequired for Kurento and Millicast group call conferencing.
conferenceContainerThe container selector to host the remote participant's stream in a player.
hlsTemplateWhen using Wowza. The HLS url template to use when subscribing in a group call as HLS.https://{serverURL}/{appName}/{streamName}/playlist.m3u8
conferenceSubscribeHlsSet to true to subscribe to remote participants in a group call as HLS instead of WebRTC.
peerSubscribeRequired for Kurento group call conferencing.

Subscriber Options

PropertyDescriptionDefault
serverURLThe host of the websocket service. For Wowza the url is configured from the host.
serverThe server type. For now Wowza is supported with other signalling servers after.wowza
userDataCustom data to send to the Wowza server.
debugTurn on internal peering logs.false

Millicast Options

{
    "millicast": {
        "accountId": "",
        "publishToken": "",
        "subToken": ""
    }
}
PropertyDescriptionDefault
accountIdMillicast account id shown in the api key section.
publishTokenThe publishing token created in the api section. This is used for generating the signal server url unless supplied using serverURL
subTokenSubscriber token generated by the backend using the secret key and Millicast api. This is used when authenticated subscriber is enabled for the publish token.
userDataCustom data to send to the Wowza server.
debugTurn on internal peering logs.false

AWS Kinesis Options

Supplied is lambda and authorizer scripts to handle the signal channel ice servers and signed WebSocket url. Supplied is scripts to generate encrypted JWE tokens for the token authorizer. JWE provides encrypted token payloads.

"kinesisvideo": {
            "publishUrl": "https://api.electroteque.org/publish",
            "publishToken": "eyJhbGciOiJBMjU2S1ciLCJlbmMiOiJBMjU2Q0JDLUhTNTEyIn0.jtz-Wru3hxJlLmaBcgPzHgLwn-wPHEgo_cRRFg6DhR0toIHFBPmKXDUTaVlG_jBCo9TQ8VPFXoI03UK4QBOYXcKdgog0EOf7._TKhqyvVDOkZLw83ObkXVg.NFTZe7zRQH-syEC6Zn2izADtOdbM6tGyrGycfd7DYh3M7npPdXltMu50uQG8Q-A-09p4-TimibbevbxxShBjTaCGwZBMfevdQW6KNQiLXAFQSP2rlqfTK-Kf-cT-RZ3_VeeGopbWhzJ-AJbwVDV3_uQ8R0yPP2TanfBiy8etb5mNzqexbqRp5PFI7P54amcj.qmVpOoZi1mByhN88n8Jl_7Rune9cTnBNTf6neWrpEQE",
}
"kinesisvideo": {
            "subscribeUrl": "https://api.electroteque.org/subscribe",
            "subscribeToken": "eyJhbGciOiJBMjU2S1ciLCJlbmMiOiJBMjU2Q0JDLUhTNTEyIn0.acMKeL-pp0aAxlYeV3C3YzqxgCq2uPnBlEae7SCsV3ic4nBQt207lfL1-XinVvVHXUVkG2r3-S2TFtsbNNchhNscFH_FiVxh.qZ9fmfleXUtXfvHChFwPNg.Zx_9MSy4osZsT0VUYZF3C9Mknc8o3vigrcVZUboO9TBWZu8DpUdxBmR3ddA4Dk--Zjl6_5un9nBXD7z2ZKMbjsaqT2w4udI9WNjOstpSFjhbtC6e7laOfBv2ZIeKGfkk8ogZ3ZnYyXlyU6zM1nAvKfD3DezTCPzVQbHMa5N6bOlYJce4lCl_2wwWtgi-NFfBv8z-ZrcOzxlx9HrqUqUyAA.fybw2HIJANCYuaKli1I2xbt3606WdyGqeYADVLvh2LE"
}
"kinesisvideo": {
            "credentials": {
                "accessKeyId": "",
                "secretAccessKey": ""
            }
}
PropertyDescriptionDefault
regionThe AWS region for the signalling channel.
publishTokenThe publishing token for custom AWS Lambda authorizer.
subcribeTokenThe viewer subscriber token for custom AWS Lambda authorizer.
accessKeyIdThe AWS access key id
secretAccessKeyThe AWS secret key

Virtual Background Removal Plugin Options

PropertyDescriptionDefault
renderTypeThe background rendering type. Either bodypix, or screenbodypix
accurateUse the fast or slow Bodypix architecture config. Slow is more accurate but more intensive.false
internalResolutionThe resolution for segmenting the detected body from the background. Medium or high.medium
segmentationThresholdAn accuracy threshold for segmentation.0.5
bgImageurl to the background image to use as a video background.
fastThe fast least accurate Bodypix config.{
"architecture": 'MobileNetV1',
"outputStride": 16,
"multiplier": 0.75,
"quantBytes": 2
}
slowThe slow more accurate Bodypix config.{
"architecture": 'ResNet50',
"outputStride": 16,
"multiplier": 1,
"quantBytes": 2
}
bgImageThe background poster image for the background texture of the video rendering.
scaledWidthThe width to scale the video to when switching to screensharing as the background.

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 protected] --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.

Millicast Console

After adding a stream. A Publish key and Account ID is displayed to configure the publisher and subscriber with.

Millicast Console

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