Starts pushing media streams to the CDN directly.

virtual int startDirectCdnStreaming(IDirectCdnStreamingEventHandler* eventHandler,
            const char* publishUrl, const DirectCdnStreamingMediaOptions& options) = 0;


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 published by the host to the CDN, 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.


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


  • 0: Success.
  • < 0: Failure.