RTMP support is a feature that allows you to stream your live event using stream sources other than the one from your own device. The stream source uses RTMP, also known as the Real-Time Messaging Protocol, to offer seamless media stream ingest to the Sendbird server. You can use a RTMP provider such as OBS studio.
RTMP stream can be created and deleted only by using the client app. The following guide contains the details on how you can use RTMP stream.
Using RTMP stream
To start a live event using RTMP stream, create a live event by calling
createLiveEvent(). Then, call the
createRTMPStream() method which creates and connects a host to the live event. When the method is called successfully, RTMP stream data such as
streamKey are passed in the
RtmpStreamData object as well. You can use the
streamKey to the RTMP provider of your choice to start streaming the video source to the client app.
When you have already created and started your live event using WebRTC stream, you can switch to RTMP stream by exiting the incumbent host and calling the
createRTMPStream() method. If not, an error will return to notify you that a host already exists in the live event.
In case the RTMP connection is interrupted and your RTMP provider gets disconnected from the Sendbird server during a live event, the server will automatically notify the participants that the host has been disconnected from the live event. When the RTMP provider is reconnected to the server, participants will be notified that the host has been connected again.
The media server detects an incoming RTMP stream from a RTMP provider.
The media server no longer detects a RTMP stream from a RTMP provider.
Saving stream key and the host URL
For security reasons, it is recommended that you store the
rtmpHostUrl securely when you create a stream. These information are only shown to the user when the RTMP stream is created and the key is only valid for 10 minutes upon its creation. If you lose the information and cannot connect to the RTMP provider, call
createRTMPStream() again and create a new RTMP stream. New sets of stream key and host URL will be created each time you call the method.
Stop using RTMP stream
To stop streaming with RTMP, call the
deleteRTMPStream() method. When
deleteRTMPStream() is called, the host will be automatically exited from the live event and media streaming will be stopped.
On the other hand, if the host stops streaming from the RTMP provider and
deleteRTMPStream() isn't called, the live event will show a black screen to the participants. If RTMP stream isn't detected for 10 minutes, the host will be disconnected from the live event. If there aren't any participants at this point, the live event will be ended and the host will be exited.