WebRTC publishing¶
When you develop your own application or website for exchanging video and/or audio via WebRTC, you may choose to send streams to Flussonic to enrich your project with useful cutting edge features extending the basic protocol. You may find recommendations on embedding Flussonic's WebRTC capabilities to your app here. Below are the instructions on configuring Flussonic to accept WebRTC publications.
The publication is carried out via the WHIP standard. For more details about WebRTC, WHIP and WHEP, see Using WebRTC protocol.
On this page:
Prerequisites¶
- Configure HTTPS. Most of the modern browsers allow video and audio publishing via WebRTC over a secure connection only.
- Do not close UDP ports. Flussonic does not have a fixed port range for WebRTC, i.e. the ports allocated by the OS are used. When closing UDP ports, you can accidentally close the ones that are being used. Consider not using any other software on the Flussonic server to safely allow UDP listening on all ports.
WebRTC publication settings in Flussonic¶
To accept WebRTC publication on the Flussonic server, just create a stream with publish://
input in one of the following ways:
- In the UI as described here
- Via the API:
Flussonic-API: PUT /streamer/api/v3/streams/{name}
Use the following URL for the published stream in your client application:
http://FLUSSONIC-IP:PORT/STREAM_NAME/whip
See also Streaming API reference to learn how to compile the payload for this URL.
Optional settings¶
Having created a stream with publish://
input, you can start publishing to it right away. No additional settings are strictly necessary, but you may need them to achieve certain objectives. Below are possible further settings of WebRTC publishing.
Stream parameters¶
You can configure transcoding of the WebRTC published streams at options on the same Input tab. The following settings are available in the UI:
- Output audio codec is an audio transcoding option.
- Maximum and minimum bitrate are the basic settings for Adaptive publication over WebRTC.
Note
If you want to publish with a dynamic name, these settings are set in the template instead of the stream. The full list of WebRTC stream options is available in the API schema.
Protecting your publication¶
To prevent anyone other than your users from publishing videos to the server, you can protect the publication in one of the following ways:
- Protect the publication with a password.
- Configure external authorization for the publication sessions.
Test publishing from your webcam¶
To make sure the settings are correct, you can try publishing from your webcam to the created stream. Just click Publish From Webcam on the Input tab in the stream profile and allow your browser to access your camera and microphone.
The webcam video preview window will be displayed under the button.
Warning
This publishing method is available for testing purposes only. End users usually do not have access to the Flussonic admin UI; they can publish videos through your application (website).
Publishing with adaptive bitrate¶
Publishing to Flussonic is performed at Adaptive Bit Rate (ABR) by default. This means that Flussonic helps the publication source adjust the bitrate to the bandwidth. Learn more at Adaptive publication over WebRTC.
Load balancing with WHIP publications¶
Since WHIP is based on HTTP POST requests, you can use our load balancer to distribute play requests between servers in a cluster. The balancer will redirect POST requests to servers in the cluster using the 307 HTTP redirect code.
WebRTC Player's publication options¶
If you use our WebRTC Player following the recommendations on developing the client application, you can flexibly configure the publications. You will find detailed instructions and examples in the readme. For example, you can configure it to perform:
- Audio podcasts through WebRTC. Just set
video: false
andaudio: true
in the Publisher'sconstraints
. - Custom filters application via
canvas
. The example of a webpage incorporating WebRTC Player also includes the use ofcanvas
. If you try the example, you will see that "sepia" filter is applied to the published video and "It's publishing to Flussonic!" text appears over it.