AgoraRtcMediaPlayerDelegate
Provides callbacks for media players.
reportAudioVolumeIndicationOfSpeakers
Reports the volume of the media player.
- (void)AgoraRtcMediaPlayer:(id<AgoraRtcMediaPlayerProtocol> _Nonnull)playerKit volumeIndicationDidReceive:(NSInteger)volume;
The SDK triggers this callback every 200 milliseconds to report the current volume of the media player.
Parameters
- volume
- The volume of the media player. The value ranges from 0 to 255.
didReceiveData
Occurs when the media metadata is received.
- (void)AgoraRtcMediaPlayer:(id<AgoraRtcMediaPlayerProtocol> _Nonnull)playerKit didReceiveData:(NSString *_Nullable)data length:(NSInteger)length;
The callback occurs when the player receives the media metadata and reports the detailed information of the media metadata.
Parameters
- playerKit
- See AgoraRtcMediaPlayerProtocol.
- data
- The detailed data of the media metadata.
- length
- The data length (bytes).
didPlayBufferUpdated
Reports the playback duration that the buffered data can support.
- (void)AgoraMediaPlayer:(AgoraMediaPlayer *_Nonnull)playerKit didPlayBufferUpdated:(NSInteger)playCachedBuffer;
- When the playback duration supported by the buffered data is less than the threshold (0 by default), the SDK returns AgoraMediaPlayerEventBufferLow.
- When the playback duration supported by the buffered data is greater than the threshold (0 by default), the SDK returns AgoraMediaPlayerEventBufferRecover.
Parameters
- playerKit
- See AgoraRtcMediaPlayerProtocol.
- playCachedBuffer
- The playback duration (ms) that the buffered data can support.
didOccurEvent
Reports the playback event.
(void)AgoraRtcMediaPlayer:(id<AgoraRtcMediaPlayerProtocol> _Nonnull)playerKit didOccurEvent:(AgoraMediaPlayerEvent)eventCode elapsedTime:(NSInteger)elapsedTime message:(NSString *_Nullable)message;
- After calling the seekToPosition method, the SDK triggers the callback to report the results of the seek operation.
Parameters
- playerKit
- See AgoraRtcMediaPlayerProtocol.
- eventCode
- The playback event. See AgoraMediaPlayerEvent.
- elapsedTime
- The time (ms) when the event occurs.
- message
- Information about the event.
infoUpdated
Occurs when information related to the media player changes.
- (void)AgoraRtcMediaPlayer:(id<AgoraRtcMediaPlayerProtocol> _Nonnull)playerKit infoUpdated:(AgoraMediaPlayerUpdatedInfo *_Nonnull)info;
When the information about the media player changes, the SDK triggers this callback. You can use this callback for troubleshooting.
Parameters
- playerKit
- See AgoraRtcMediaPlayerProtocol.
- info
- Information related to the media player. See AgoraMediaPlayerUpdatedInfo.
didChangedToState
Reports the playback state change.
- (void)AgoraMediaPlayer:(AgoraMediaPlayer *_Nonnull)playerKit didChangedToState:(AgoraMediaPlayerState)state error:(AgoraMediaPlayerError)error;
When the state of the media player changes, the SDK triggers this callback to report the current playback state.
Parameters
- playerKit
- See AgoraRtcMediaPlayerProtocol.
- state
- The playback state, see AgoraMediaPlayerState.
- error
- The error code. See AgoraMediaPlayerError.
didChangedPlayerSrcInfoFrom
Occurs when the video bitrate of the media resource changes.
- (void)AgoraRtcMediaPlayer:(id<AgoraRtcMediaPlayerProtocol> _Nonnull)playerKit playerSrcInfoDidChange:(AgoraMediaPlayerSrcInfo *_Nonnull)to from:(AgoraMediaPlayerSrcInfo *_Nonnull)from;
Parameters
- playerKit
- See AgoraRtcMediaPlayerProtocol.
- from
- Information about the video bitrate of the media resource being played. See AgoraMediaPlayerSrcInfo.
- to
- Information about the changed video bitrate of media resource being played. See AgoraMediaPlayerSrcInfo.
didChangedToPosition
Reports current playback progress.
- (void)AgoraMediaPlayer:(AgoraMediaPlayer *_Nonnull)playerKit didChangedToPosition:(NSInteger)position;
When playing media files, the SDK triggers this callback every one second to report current playback progress.
Parameters
- playerKit
- See AgoraRtcMediaPlayerProtocol.
- position
- The playback position (ms) of media files.
didPreloadEvent
Reports the events of preloaded media resources.
- (void)AgoraRtcMediaPlayer:(id<AgoraRtcMediaPlayerProtocol> _Nonnull)playerKit didPreloadEvent:(AgoraMediaPlayerPreloadEvent)event;
Parameters
- playerKit
- See AgoraRtcMediaPlayerProtocol.
- event
- Events that occur when media resources are preloaded. See AgoraMediaPlayerPreloadEvent.