logo
Video Call
On this page

RTMP Push Stream to ZEGO Server


Feature Introduction

In live streaming scenarios, hosts can push audio and video streams to ZEGO servers through RTMP push streaming tools to achieve low latency. Audiences can use ZEGO Express SDK to play streams.

RTMP push streaming tools refer to third-party tools that push streams through RTMP addresses, mainly including hardware push streaming devices, software OBS, etc.

Prerequisites

  • Contacted ZEGOCLOUD Technical Support to enable relevant permissions for RTMP tool push streaming to ZEGO server.
  • Prepare RTMP push streaming tool, such as OBS.

Usage Steps

Get RTMP Push Stream Address

Please contact ZEGOCLOUD Technical Support to enable the service, and get the RTMP push stream address through the RTMP Push Stream Dispatch server-side interface.

Use RTMP Tool to Push Stream

The following takes OBS as an example to introduce the push streaming operation of RTMP tools.

Set Push Stream Address

  1. Open the OBS tool, and click "Settings" in the "Controls" tab at the bottom toolbar to enter the settings interface.
  1. Click "Stream" to enter the stream settings tab, and select the service type as "Custom Streaming Server".

  2. Fill in the obtained RTMP push stream address into the "Server" and "Stream Key" fields.

  • Server: Corresponds to the RTMP push stream address, that is, rtmp://hosts/AppName/

    Please note that the RTMP push stream address URL is different from the push stream address URL in CDN Push Stream Authentication and cannot be mixed. Please pay attention to distinguish them when using.

  • Stream Key: Corresponds to the RTMP push stream name, that is, "streamID".

  1. Click "OK" to save the above settings.

Set Push Stream Guide

  1. Click the "+" button in the "Sources" tab at the bottom toolbar.
  1. Select input source as needed, such as "Display Capture".

Use OBS to Push Stream

  1. Click "Start Streaming" in the "Controls" tab at the bottom toolbar to push the audio and video stream to the set push stream address. When a green light appears at the bottom, it indicates that the push streaming is successful.
  1. If you need to stop pushing stream, click "Stop Streaming" in the "Controls" tab.
Warning

After using the RTMP tool to push stream, users cannot receive notifications of audio and video stream additions or deletions through the onRoomStreamUpdate callback. They can obtain them through the following two ways:

  • After using the RTMP tool to push stream, the business server sends the third-party push "streamID" to other users in the room through business signaling, notifying other users in the room that there are new or deleted streams.
  • You can use ZEGO server-side Add Room Stream and Delete Room Stream interfaces to add or delete a stream information to a specified room, and send the "streamID" information to other users in the room. At this time, other users can receive notifications of audio and video stream additions or deletions through the onRoomStreamUpdate callback.

Use SDK to Play/Stop Playing Stream

Call the startPlayingStream interface, pass in the "streamID" of the RTMP push stream (that is, the "Stream Key" set in section 3.2.1) to play.

// Start playing, set remote playing rendering view, view mode uses SDK default mode, proportionally scaled to fill the entire View
// The following remoteUserView is the UI View
[[ZegoExpressEngine sharedEngine] startPlayingStream:@"streamID" canvas:[ZegoCanvas canvasWithView:self.remoteUserView]];

Call the stopPlayingStream interface, pass in the "streamID" of the RTMP push stream (that is, the "Stream Key" set in section 3.2.1) to stop playing the audio and video stream published by the remote end.

// Stop playing
[[ZegoExpressEngine sharedEngine] stopPlayingStream:@"streamID"];

FAQ

1. How does the business server know whether the RTMP push streaming tool has started or stopped pushing streams?

ZEGO provides publish_start start push streaming and publish_stop stop push streaming callback notifications. If needed, please contact ZEGOCLOUD Technical Support to configure.

Previous

Single Stream Transcoding

Next

OBS Streaming with WHIP Protocol

On this page

Back to top