Agora RTC Objective-C API Reference Refactor

Instance Methods
<AgoraRtcMediaPlayerDelegate> Protocol Reference

Inherits <NSObject>.

## Instance Methods
(void) | - AgoraRtcMediaPlayer:didChangedToState:error:
(void) | - AgoraRtcMediaPlayer:didChangedToPosition:
(void) | - AgoraRtcMediaPlayer:didOccurEvent:elapsedTime:message:
(void) | - AgoraRtcMediaPlayer:didReceiveData:length:
(void) | - AgoraRtcMediaPlayer:didPlayBufferUpdated:
(void) | - AgoraRtcMediaPlayer:didPreloadEvent:
(void) | - AgoraRtcMediaPlayer:playerSrcInfoDidChange:from:
(void) | - AgoraRtcMediaPlayer:infoUpdated:
(void) | - AgoraRtcMediaPlayer:volumeIndicationDidReceive:

## Method Documentation

## ◆ AgoraRtcMediaPlayer:didChangedToState:error:

- (void) AgoraRtcMediaPlayer: |  | (id< AgoraRtcMediaPlayerProtocol > _Nonnull) | playerKit
didChangedToState: |  | (AgoraMediaPlayerState) | state
error: |  | (AgoraMediaPlayerError) | error
| optional

Reports the playback state change.

Parameters

  playerKit | AgoraRtcMediaPlayer
  state | The new playback state after change. See AgoraMediaPlayerState.
  error | The player's error code. See AgoraMediaPlayerError.

## ◆ AgoraRtcMediaPlayer:didChangedToPosition:

- (void) AgoraRtcMediaPlayer: |  | (id< AgoraRtcMediaPlayerProtocol > _Nonnull) | playerKit
didChangedToPosition: |  | (NSInteger) | position
| optional

Reports current playback progress.

The callback occurs once every one second during the playback and reports current playback progress.

Parameters

  playerKit | AgoraMediaPlayer
  position | Current playback progress (s).

## ◆ AgoraRtcMediaPlayer:didOccurEvent:elapsedTime:message:

- (void) AgoraRtcMediaPlayer: |  | (id< AgoraRtcMediaPlayerProtocol > _Nonnull) | playerKit
didOccurEvent: |  | (AgoraMediaPlayerEvent) | eventCode
elapsedTime: |  | (NSInteger) | elapsedTime
message: |  | (NSString *_Nullable) | message
| optional

Reports the result of the seek operation.

Parameters

  playerKit | AgoraRtcMediaPlayer
  eventCode | AgoraMediaPlayerEvent
  elapsedTime | The playback elapsed time.
  message | NSString

## ◆ AgoraRtcMediaPlayer:didReceiveData:length:

- (void) AgoraRtcMediaPlayer: |  | (id< AgoraRtcMediaPlayerProtocol > _Nonnull) | playerKit
didReceiveData: |  | (NSString *_Nullable) | data
length: |  | (NSInteger) | length
| optional

Reports the reception of the media metadata.

The callback occurs when the player receivers the media metadata and reports the detailed information of the media metadata.

Parameters

  playerKit | AgoraRtcMediaPlayer
  data | The detailed data of the media metadata.
  length | The length (byte) of the data.

## ◆ AgoraRtcMediaPlayer:didPlayBufferUpdated:

- (void) AgoraRtcMediaPlayer: |  | (id< AgoraRtcMediaPlayerProtocol > _Nonnull) | playerKit
didPlayBufferUpdated: |  | (NSInteger) | playCachedBuffer
| optional

Triggered when play buffer updated, once every 1 second.

Parameters

  playerKit | AgoraRtcMediaPlayer
  playCachedBuffer | NSInteger

## ◆ AgoraRtcMediaPlayer:didPreloadEvent:

- (void) AgoraRtcMediaPlayer: |  | (id< AgoraRtcMediaPlayerProtocol > _Nonnull) | playerKit
didPreloadEvent: |  | (AgoraMediaPlayerPreloadEvent) | event
| optional

Triggered when the player preloadSrc.

Parameters

  playerKit | AgoraRtcMediaPlayer
  event | AgoraMediaPlayerPreloadEvent

## ◆ AgoraRtcMediaPlayer:playerSrcInfoDidChange:from:

- (void) AgoraRtcMediaPlayer: |  | (id< AgoraRtcMediaPlayerProtocol > _Nonnull) | playerKit
playerSrcInfoDidChange: |  | (AgoraMediaPlayerSrcInfo *_Nonnull) | to
from: |  | (AgoraMediaPlayerSrcInfo *_Nonnull) | from
| optional

Reports current playback source bitrate changed.

Parameters

  to | Streaming media information after the change.
  from | Streaming media information before the change.

## ◆ AgoraRtcMediaPlayer:infoUpdated:

- (void) AgoraRtcMediaPlayer: |  | (id< AgoraRtcMediaPlayerProtocol > _Nonnull) | playerKit
infoUpdated: |  | (AgoraMediaPlayerUpdatedInfo *_Nonnull) | info
| optional

Triggered when media player information updated.

Parameters

  info | Include information of media player.

## ◆ onAgoraCDNTokenWillExpire

- (void) onAgoraCDNTokenWillExpire |  |  |
| optional

AgoraCDN Token has expired and needs to be set up with renewAgoraCDNSrcToken(const char* src).

## ◆ AgoraRtcMediaPlayer:volumeIndicationDidReceive:

- (void) AgoraRtcMediaPlayer: |  | (id< AgoraRtcMediaPlayerProtocol > _Nonnull) | playerKit
volumeIndicationDidReceive: |  | (NSInteger) | volume
| optional

Triggered when play volume updated, once every 200 millisecond.

Parameters

  volume | volume of current player.