startRtmpStreamWithTranscodingEx abstract method

Future<void> startRtmpStreamWithTranscodingEx({
  1. required String url,
  2. required LiveTranscoding transcoding,
  3. required RtcConnection connection,
})

Starts Media Push and sets the transcoding configuration.

Agora recommends that you use the server-side Media Push function. You can call this method to push a live audio-and-video stream to the specified CDN address and set the transcoding configuration. This method can push media streams to only one CDN address at a time, so if you need to push streams to multiple addresses, call this method multiple times. After you call this method, the SDK triggers the onRtmpStreamingStateChanged callback on the local client to report the state of the streaming. Ensure that you enable the Media Push service before using this function. Call this method after joining a channel. Only hosts in the LIVE_BROADCASTING profile can call this method. If you want to retry pushing streams after a failed push, make sure to call stopRtmpStreamEx first, then call this method to retry pushing streams; otherwise, the SDK returns the same error code as the last failed push.

  • url The address of Media Push. The format is RTMP or RTMPS. The character length cannot exceed 1024 bytes. Special characters such as Chinese characters are not supported.
  • transcoding The transcoding configuration for Media Push. See LiveTranscoding.
  • connection The connection information. See RtcConnection.

Returns When the method call succeeds, there is no return value; when fails, the AgoraRtcException exception is thrown. You need to catch the exception and handle it accordingly.

Implementation

Future<void> startRtmpStreamWithTranscodingEx(
    {required String url,
    required LiveTranscoding transcoding,
    required RtcConnection connection});