Broadcast Using RTMP
Important
RTMP is available for LiveSwitch Cloud as an add-on feature. To enable RTMP for your subscription to LiveSwitch Cloud, contact Sales.
Real-Time Messenger Protocol (RTMP) is an online streaming protocol that was created to distribute media. Originally designed for streaming with Adobe’s Flash player, RTMP is still used as an ingest protocol for some streaming services. For example, RTMP can be used to deliver LiveSwitch media to online streaming platforms like Twitch, Facebook Live, or YouTube Live.
LiveSwitch’s RTMP implementation supports delivery of its MCU audio and video output to an RTMP ingest service. The following codecs are supported:
RTMP supports up to five upstream participants.
To use RTMP to broadcast on your channel, do the following:
- Enable and configure RTMP from LiveSwitch Cloud.
- To start the RTMP stream on your channel, do one of the following:
- If your channel is active, restart it.
- If your channel is active but you don't want to restart it, start the RTMP stream with the LiveSwitch SDK.
- If your channel isn't active, activate it.
Note
About the code examples on this page:
- For .NET MAUI, Unity, Xamarin Android, Xamarin iOS, and Xamarin macOS, use the C# code.
- For Java, use the Android code.
- For macOS, use the iOS code.
Start or Stop an RTMP Broadcast on an Active Channel
Use the LiveSwitch SDK to start or stop an RTMP broadcast on an active channel with RTMP configured. Ensure that you have a subscription that authorizes RTMP and you have set the RTMP URL and Stream Key on the console.
// Prior to registration, ensure that you create a channel claim with the CanUpdate property set to true.
var channelClaims = new[] { new ChannelClaim(ChannelId) { CanUpdate = true } };
// Create a registration token with your ChannelClaims then call `client.register(token)`.
// Create a new ChannelConfig, and set EnableRtmp to true.
var channelConfig = new ChannelConfig();
channelConfig.EnableRtmp = true;
// Send the update - the channel object here is returned when calling `client.register(token)`.
channel.Update(channelConfig);
// To stop the RTMP stream, set EnableRtmp to false and send the update
channelConfig.EnableRtmp = false;
channel.Update(channelConfig);