Live Streaming
Apps that have integrated with the Zoom Video SDK can live stream a session to Facebook Live, YouTube Live, and a number of other custom live streaming platforms.
In this section, we will show you how to set up a streaming event in a third-party platform (YouTube) and implement a feature to start and stop live streaming of a session using the Video.
Retrieve live streaming credentials from selected platform
Live streaming with SDKs requires the following information from third-party streaming platforms: Stream URL, Stream Key, Broadcast URL.
For instance, if you wanted to livestream a session to YouTube, you must Enable Live Streaming on your Google account.
To automate the following steps and get stream information programmatically, you may also want to utilize the YouTube Live Streaming API.
Step 1: Login to YouTube. Locate the video icon and press “Go Live”.
Step 2: Click the Stream button in the top panel. Note: YouTube Webcam services are not compatible with Zoom SDK.
Step 3: Fill out the required information and toggle “Schedule for later”. If this is not selected, the live stream will start immediately and will not provide setting info.
Step 4: After creating the stream, the Steam URL and Stream Key will be available.
Start live streaming the session
To start live streaming a session from your app, first obtain an instance of ZMVideoSDKLiveStreamHelper
and verify that the current user can start streaming. Then call startLiveStream
within ZMVideoSDKLiveStreamHelper
to begin live streaming.
// Get the ZMVideoSDKLiveStreamHelper to perform live stream actions.ZMVideoSDKLiveStreamHelper *liveStreamHelper = [[ZMVideoSDK sharedZMVideoSDK] getLiveStreamHelper];// Check if the live stream can start.if ([liveStreamHelper canStartLiveStream] == ZMVideoSDKErrors_Success) {// Call startLiveStreamWithStreamingURL to begin the live stream.ZMVideoSDKErrors liveStreamStartReturnValue = [liveStreamHelper startLiveStream:streamURL broadcastUrl:broadcastURL liveStreamKey:streamingKey];switch (liveStreamStartReturnValue) {case ZMVideoSDKErrors_Success:// Live stream successfully began.break;case ZMVideoSDKErrors_Meeting_Live_Stream_Error:// Live stream could not start.break;default:break;}}
// Get the ZMVideoSDKLiveStreamHelper to perform live stream actions.if let liveStreamHelper = ZMVideoSDK.shared()?.getLiveStreamHelper() {// Check if the live stream can start.if liveStreamHelper.canStartLiveStream() == ZMVideoSDKErrors_Success {// Call startLiveStream to begin the live stream.let liveStreamStartReturnValue = lliveStreamHelper.startLiveStream(streamingURL, broadcastUrl: broadcastURL, liveStreamKey: streamingKey)switch liveStreamStartReturnValue {case ZMVideoSDKErrors_Success:// Live stream successfully began.breakcase ZMVideoSDKErrors_Meeting_Live_Stream_Error:// Live stream could not start.breakdefault:break}}}
To stop the stream using the SDK, call the stopLiveStream
method.
// Get the ZMVideoSDKLiveStreamHelper to perform livestream actions.ZMVideoSDKLiveStreamHelper *liveStreamHelper = [[ZMVideoSDK sharedZMVideoSDK] getLiveStreamHelper];// Call stopLiveStream to stop the live stream.[liveStreamHelper stopLiveStream];
// Get the ZMVideoSDKLiveStreamHelper to perform livestream actions.if let liveStreamHelper = ZMVideoSDK.shared()?.getLiveStreamHelper() {// Call stopLiveStream to stop the live stream.liveStreamHelper.stopLiveStream()}
After calling the startLiveStream
function, listen for updates through your ZMVideoSDKDelegate
implementation's onLiveStreamStatusChanged
callback.
Name | Description |
---|---|
ZMVideoSDKLiveStreamStatus_None | No live stream is active. |
ZMVideoSDKLiveStreamStatus_InProgress | Live streaming is in progress. |
ZMVideoSDKLiveStreamStatus_Ended | Live streaming has ended. |
Need help?
If you're looking for help, try Developer Support or our Developer Forum. Priority support is also available with Premier Developer Support plans.