Agora RTC Objective-C API Reference Refactor

Instance Methods
AgoraLivePublisher Class Reference

Inherits <NSObject>.

## Instance Methods
(void) | - setDelegate:
(instancetype _Nonnull) | - initWithLiveKit:
(void) | - setMediaType:
(void) | - addStreamUrl:transcodingEnabled:
(void) | - removeStreamUrl:
(void) | - publish
(void) | - unpublish
(void) | - switchCamera

## Detailed Description

The AgoraLivePublisher class manages all actions related to live broadcast publishing.

## Method Documentation

## ◆ setDelegate:

- (void) setDelegate: |  | (_Nullable id< AgoraLivePublisherDelegate >) | delegate |

Sets the delegate.

Parameters

  delegate | AgoraLivePublisherDelegate

## ◆ initWithLiveKit:

- (instancetype _Nonnull) initWithLiveKit: |  | (AgoraLiveKit *_Nonnull) | kit |

Initializes the publisher.

Parameters

  kit | AgoraLiveKit

Returns
  AgoraLivePublisher object

## ◆ setMediaType:

- (void) setMediaType: |  | (AgoraMediaType) | mediaType |

Sets the media type.

Parameters

  mediaType | AgoraMediaType

## ◆ addStreamUrl:transcodingEnabled:

- (void) addStreamUrl: |  | (NSString *_Nullable) | url
transcodingEnabled: |  | (BOOL) | transcodingEnabled

Adds a stream URL.

This method is used for CDN live. It adds the URL to which the host publishes the stream. Note: This method only adds one URL each time it is called.

Parameters

  url | URL to which the host publishes the stream.
  transcodingEnabled | * True: Enable transcoding. False: Disable transcoding.

## ◆ removeStreamUrl:

- (void) removeStreamUrl: |  | (NSString *_Nullable) | url |

Removes a stream URL.

This method is used for CDN live. It removes the URL to which the host publishes the stream. Note: This method only removes one URL each time it is called.

Parameters

  url | URL to which the host publishes the stream.

## ◆ publish

- (void) publish |  |  |

Publishes a stream.

## ◆ unpublish

- (void) unpublish |  |  |

Stops stream publishing.

## ◆ switchCamera

- (void) switchCamera |  |  |

Switches between front and rear cameras.