Agora RTC Objective-C API Reference Refactor

Instance Methods
<AgoraRtcMediaPlayerDelegate> Protocol Reference

Inherits <NSObject>.

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

## Method Documentation

## ◆ AgoraRtcMediaPlayer:didChangedToState:reason:

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

Reports the playback state change.

Parameters

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

## ◆ AgoraRtcMediaPlayer:didChangedToPosition:atTimestamp:

- (void) AgoraRtcMediaPlayer: |  | (id< AgoraRtcMediaPlayerProtocol > _Nonnull) | playerKit
didChangedToPosition: |  | (NSInteger) | positionMs
atTimestamp: |  | (NSTimeInterval) | timestampMs
| optional

Reports current playback progress.

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

Parameters

  playerKit | AgoraMediaPlayer
  positionMs | Current playback progress (ms).
  timestampMs | The NTP timestamp (ms) when the position is sent.

## ◆ 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.

## ◆ AgoraRtcMediaPlayer:cacheStats:

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

Triggered every 1 second, reports the statistics of the files being cached.

Parameters

  info | Cached file statistics.

## ◆ AgoraRtcMediaPlayer:playbackStats:

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

Triggered every 1 second, reports the statistics of the media stream being played.

Parameters

  info | The statistics of the media stream.

## ◆ 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.