AgoraMediaPlayerDelegate Category Reference

Conforms to NSObject
Declared in AgoraMediaPlayerKit.h

Overview

The AgoraMediaPlayerDelegate protocol, reporting the event callbacks.

– AgoraMediaPlayer:didChangedToState:error:

Reports the playback state change.

- (void)AgoraMediaPlayer:(AgoraMediaPlayer *_Nonnull)playerKit didChangedToState:(AgoraMediaPlayerState)state error:(AgoraMediaPlayerError)error

Parameters

playerKit

AgoraMediaPlayer

state

The new playback state after change. See AgoraMediaPlayerState.

error

The player’s error code. See AgoraMediaPlayerError.

Declared In

AgoraMediaPlayerKit.h

– AgoraMediaPlayer:didChangedToPosition:

Reports current playback progress.

- (void)AgoraMediaPlayer:(AgoraMediaPlayer *_Nonnull)playerKit didChangedToPosition:(NSInteger)position

Parameters

playerKit

AgoraMediaPlayer

position

Current playback progress (millionseconds).

Discussion

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

Declared In

AgoraMediaPlayerKit.h

– AgoraMediaPlayer:didOccurEvent:

Reports the playback event.

- (void)AgoraMediaPlayer:(AgoraMediaPlayer *_Nonnull)playerKit didOccurEvent:(AgoraMediaPlayerEvent)event

Parameters

playerKit

AgoraMediaPlayer

event

The playback event. See AgoraMediaPlayerEvent.

Discussion

  • After calling the seekToPosition method, the MediaPlayer Kit occurs the callback to report the results of the seek operation.
  • After calling the selectAudioTrack method, the MediaPlayer Kit occurs the callback to report that the audio track changes.
  • After calling the switchSrc method, the MediaPlayer Kit occurs the callback to report the results of the switch operation.

Declared In

AgoraMediaPlayerKit.h

– AgoraMediaPlayer:metaDataType:didReceiveData:length:

Reports the reception of the media metadata.

- (void)AgoraMediaPlayer:(AgoraMediaPlayer *_Nonnull)playerKit metaDataType:(AgoraMediaPlayerMetaDataType)type didReceiveData:(NSString *)data length:(NSInteger)length

Parameters

playerKit

AgoraMediaPlayer

type

The type of the media metadata. See AgoraMediaPlayerMetaDataType.

data

The detailed data of the media metadata.

length

The length (byte) of the data.

Discussion

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

Declared In

AgoraMediaPlayerKit.h

– AgoraMediaPlayer:didReceiveVideoFrame:

Occurs when each time the player receives a video frame.

- (void)AgoraMediaPlayer:(AgoraMediaPlayer *_Nonnull)playerKit didReceiveVideoFrame:(CVPixelBufferRef)pixelBuffer

Parameters

playerKit

AgoraMediaPlayer

pixelBuffer

The detailed information of the video frame.

Discussion

After registering the video frame observer, the callback occurs when each time the player receives a video frame, reporting the detailed information of the video frame.

Declared In

AgoraMediaPlayerKit.h

– AgoraMediaPlayer:didReceiveAudioFrame:

Occurs when each time the player receives an audio frame.

- (void)AgoraMediaPlayer:(AgoraMediaPlayer *_Nonnull)playerKit didReceiveAudioFrame:(CMSampleBufferRef)audioFrame

Parameters

playerKit

AgoraMediaPlayer

audioFrame

The detailed information of the audio frame.

Discussion

After registering the audio frame observer, the callback occurs when each time the player receives an audio frame, reporting the detailed information of the audio frame.

Declared In

AgoraMediaPlayerKit.h

– AgoraMediaPlayer:didPlayBufferUpdated:

Reports the playback duration that the buffered data can support.

- (void)AgoraMediaPlayer:(AgoraMediaPlayer *_Nonnull)playerKit didPlayBufferUpdated:(NSInteger)playCachedBuffer

Parameters

playerKit

AgoraMediaPlayer

playCachedBuffer

The playback duration (ms) that the buffered data can support.

Discussion

In the process of playing online media resources, the mediaplayer kit triggers this callback every one second to report the playback duration that the currently buffered data can support.

  • When the playback duration supported by the buffered data is less than the threshold (0 by default), the mediaplayer kit returns AgoraMediaPlayerEventBufferLow(6).
  • When the playback duration supported by the buffered data is greater than the threshold (0 by default), the mediaplayer kit returns AgoraMediaPlayerEventBufferRecover(7).

Declared In

AgoraMediaPlayerKit.h

– AgoraMediaPlayer:didPreloadEvent:

Reports the events for preloading media resources.

- (void)AgoraMediaPlayer:(AgoraMediaPlayer *_Nonnull)playerKit didPreloadEvent:(AgoraMediaPlayerPreloadEvent)event

Parameters

playerKit

AgoraMediaPlayer

event

Events that occur when media resources are preloaded. See AgoraMediaPlayerPreloadEvent.

Declared In

AgoraMediaPlayerKit.h