startDirectCdnStreaming

Starts pushing media streams to the CDN directly.

Future<void> startDirectCdnStreaming(
      {required DirectCdnStreamingEventHandler eventHandler,
      required String publishUrl,
      required DirectCdnStreamingMediaOptions options});

Details

Aogra does not support pushing media streams to one URL repeatedly.

Media options

Agora does not support setting the value of publishCameraTrack and publishCustomVideoTrack as true, or the value of publishMicrophoneTrack and publishCustomAudioTrack as true at the same time. When choosing media setting options (DirectCdnStreamingMediaOptions), you can refer to the following examples:

If you want to push audio and video streams captured by the host from a custom source, the media setting options should be set as follows:

  • publishCustomAudioTrack is set as true and call the pushAudioFrame method
  • publishCustomVideoTrack is set as true and call the pushVideoFrame method
  • publishCameraTrack is set as false (the default value)
  • publishMicrophoneTrack is set as false (the default value)
As of v4.2.0, Agora SDK supports audio-only live streaming. You can set publishCustomAudioTrack or publishMicrophoneTrack in DirectCdnStreamingMediaOptions as true and call pushAudioFrame to push audio streams.
Note: Agora only supports pushing one audio and video streams or one audio streams to CDN.

Parameters

eventHandler
See onDirectCdnStreamingStateChanged and onDirectCdnStreamingStats.
publishUrl
The CDN live streaming URL.
options
The media setting options for the host. See DirectCdnStreamingMediaOptions.

Exceptions

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.