Call streaming
Voximplant allows users to stream audio and video calls to different streaming platforms. Currently, the platform allows developers to stream only one separate Call object. Streaming multiple participants with mixed audio and video is not yet available.
To stream, you need to obtain two parameters from a streaming account: stream name/key and server URL. After that you need to set up streaming in your scenario.
Contents
Stream to Youtube
You need to obtain two parameters from a streaming account to use them in a Voximplant JS scenario: stream name/key and server URL. The steps below show how to retrieve these values from YouTube.
Log in to your Google account, then click on your profile picture in the top right corner and choose YouTube Studio (beta).
If you do not have a YouTube channel, a special dialog appears. Click the Create channel button to be able to live stream within 24 hours.
Go to the YouTube Studio, choose Other features → Live stream now in the left menu. This opens a window with credentials to use in your scenario.
Stream to Twitch
Log in to your account, then click on your profile picture in the top right corner and choose Video Producer.
Switch to the Channel tab in the Settings block, then click Copy at the top of the page to get your Primary Stream Key. Note that the key is available only for accounts with enabled two-factor authentication. Use these credentials in your scenario.
To find the server url value, visit https://stream.twitch.tv/ingests/, choose one of the recommended endpoints, and copy it without the last slash, for example: rtmp://live-sfo.twitch.tv/app.
Stream to Restream.io
Log in to your account, then click Add channel on your dashboard, pick a streaming service to connect to (e.g., Twitch), and grant access to it.
When at least one service is connected, your dashboard changes – there is a preview window along with a streaming settings block on the right side of the screen. Use these credentials in your scenario
Pay attention to the dropdown to the left of URL where you can choose your location. It looks like a target icon by default, which means "autodetect". Change it if needed.
Process streaming in the scenario
When you obtain the stream name/key and server URL from a streaming platform, you need to process streaming in the VoxEngine scenario.
Prerequisites
- Create an application.
- Create a scenario.
- Create a routing rule and attach it to the scenario.
- Create a user to log in your client.
You need a working web or mobile application to make calls. Refer to the Basic call functionality to learn how to create it.
Scenario setup
In the scenario, require the StreamingAgent module and use the createStreamingAgent method to create a streaming object. Pass your streaming credentials to the object. Pay attention that RTMP supports only the H.264 codec, so it is crucial to specify it for streaming purposes.
Then use the sendMediaTo to send your call data to the stream. Currently, the platform allows developers to stream only one separate Call object. Streaming multiple participants with mixed audio and video is not yet available.
Refer to the code example to understand how it works: