Agora RTC Objective-C API Reference Refactor

Public Member Functions
IRtmpStreamingService Class Referenceabstract

Inherits RefCountInterface.

## Public Member Functions
virtual int | startRtmpStreamWithoutTranscoding (const char *url, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | startRtmpStreamWithTranscoding (const char *url, const LiveTranscoding &transcoding, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | updateRtmpTranscoding (const LiveTranscoding &transcoding, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | stopRtmpStream (const char *url, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | registerObserver (IRtmpStreamingObserver *observer, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | unregisterObserver (IRtmpStreamingObserver *observer)=0

## Detailed Description

The IRtmpStreamingService class, which enables the live stream service.

## Constructor & Destructor Documentation

## ◆ ~IRtmpStreamingService()

~IRtmpStreamingService | ( |  | ) |
| inline protected

## Member Function Documentation

## ◆ startRtmpStreamWithoutTranscoding()

virtual int startRtmpStreamWithoutTranscoding | ( | const char * | url,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| pure virtual

Publishes the local stream without transcoding to a specified CDN live RTMP address. (CDN live only.)

The SDK returns the result of this method call in the onStreamPublished callback.

The startRtmpStreamWithoutTranscoding method call triggers the onRtmpStreamingStateChanged callback on the local client to report the state of adding a local stream to the CDN.

Note
  - Ensure that the user joins the channel before calling this method.
  - This method adds only one stream RTMP URL address each time it is called.
  - The RTMP URL address must not contain special characters, such as Chinese language characters.
  - This method applies to Live Broadcast only.

Parameters

  url | The CDN streaming URL in the RTMP format. The maximum length of this parameter is 1024 bytes.

Returns
  - 0: Success.
  - < 0: Failure.
    - ERR_INVALID_ARGUMENT (2): The RTMP URL address is NULL or has a string length of 0.
    - ERR_NOT_INITIALIZED (7): You have not initialized the RTC engine when publishing the stream.
    - ERR_ALREADY_IN_USE (19): This streaming URL is already in use. Use a new streaming URL for CDN streaming.

## ◆ startRtmpStreamWithTranscoding()

virtual int startRtmpStreamWithTranscoding | ( | const char * | url,
|  | const LiveTranscoding & | transcoding,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| pure virtual

Publishes the local stream with transcoding to a specified CDN live RTMP address. (CDN live only.)

The SDK returns the result of this method call in the onStreamPublished callback.

The startRtmpStreamWithTranscoding method call triggers the onRtmpStreamingStateChanged callback on the local client to report the state of adding a local stream to the CDN.

Note
  - Ensure that the user joins the channel before calling this method.
  - This method adds only one stream RTMP URL address each time it is called.
  - The RTMP URL address must not contain special characters, such as Chinese language characters.
  - This method applies to Live Broadcast only.

Parameters

  url | The CDN streaming URL in the RTMP format. The maximum length of this parameter is 1024 bytes.
  transcoding | Sets the CDN live audio/video transcoding settings. See LiveTranscoding.

Returns
  - 0: Success.
  - < 0: Failure.
    - ERR_INVALID_ARGUMENT (2): The RTMP URL address is NULL or has a string length of 0.
    - ERR_NOT_INITIALIZED (7): You have not initialized the RTC engine when publishing the stream.
    - ERR_ALREADY_IN_USE (19): This streaming URL is already in use. Use a new streaming URL for CDN streaming.

## ◆ updateRtmpTranscoding()

virtual int updateRtmpTranscoding | ( | const LiveTranscoding & | transcoding,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| pure virtual

Update the video layout and audio settings for CDN live. (CDN live only.)

Note
  This method applies to Live Broadcast only.

Parameters

  transcoding | Sets the CDN live audio/video transcoding settings. See LiveTranscoding.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ stopRtmpStream()

virtual int stopRtmpStream | ( | const char * | url,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| pure virtual

Stop an RTMP stream with transcoding or without transcoding from the CDN. (CDN live only.)

This method removes the RTMP URL address (added by the startRtmpStreamWithoutTranscoding method or IRtcEngine::startRtmpStreamWithTranscoding "startRtmpStreamWithTranscoding" method) from a CDN live stream. The SDK returns the result of this method call in the onStreamUnpublished callback.

The stopRtmpStream method call triggers the onRtmpStreamingStateChanged callback on the local client to report the state of removing an RTMP stream from the CDN.

Note
  - This method removes only one RTMP URL address each time it is called.
  - The RTMP URL address must not contain special characters, such as Chinese language characters.
  - This method applies to Live Broadcast only.

Parameters

  url | The RTMP URL address to be removed. The maximum length of this parameter is 1024 bytes.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ registerObserver()

virtual int registerObserver | ( | IRtmpStreamingObserver * | observer,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| pure virtual

Registers an RTMP streaming observer.

Parameters

  observer | The pointer to an RTMP streaming observer. See IRtmpStreamingObserver.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ unregisterObserver()

virtual int unregisterObserver | ( | IRtmpStreamingObserver * | observer | ) |
| pure virtual

Releases the RTMP streaming observer created by registerObserver().

Parameters

  observer | The pointer to the RTMP streaming observer that you want to release. See IRtmpStreamingObserver.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ AddRef()

virtual void AddRef | ( |  | ) | const
| pure virtual inherited

## ◆ Release()

virtual RefCountReleaseStatus Release | ( |  | ) | const
| pure virtual inherited

## ◆ HasOneRef()

virtual bool HasOneRef | ( |  | ) | const
| pure virtual inherited