ZegoMediaPlayer

Zego MediaPlayer.

Declared in ZegoExpressDefines.h

Includes

Property Lists

  • totalDuration - Total duration of media resources @discussion You should load resource before getting this variable, otherwise the value is 0 @discussion The unit is millisecond.
  • currentProgress - Current playback progress of the media resource @discussion You should load resource before getting this variable, otherwise the value is 0 @discussion The unit is millisecond.
  • volume - Current volume @discussion The range is 0 ~ 100.
  • currentState - Player's current playback status.
  • index - Media player index.

Public-Func Lists

Property Docs

totalDuration

Total duration of media resources @discussion You should load resource before getting this variable, otherwise the value is 0 @discussion The unit is millisecond.

currentProgress

Current playback progress of the media resource @discussion You should load resource before getting this variable, otherwise the value is 0 @discussion The unit is millisecond.

volume

Current volume @discussion The range is 0 ~ 100.

currentState

Player's current playback status.

index

Media player index.

Public-Func Docs

setEventHandler:

- (void)setEventHandler:(nullable id< ZegoMediaPlayerEventHandler >) handler;

Set event callback handler for media player.

Parameters
handler Media player event callback object

setVideoHandler:format:type:

- (void)setVideoHandler:(nullable id< ZegoMediaPlayerVideoHandler >) handler format:(ZegoVideoFrameFormat) format type:(ZegoVideoBufferType) type;

Set video callback handler.

Parameters
handler Video event callback object for media player
format Video frame format for video data
type Buffer type for video data

setAudioHandler:

- (void)setAudioHandler:(nullable id< ZegoMediaPlayerAudioHandler >) handler;

Set audio callback handler.

Parameters
handler Audio event callback object for media player

loadResource:callback:

- (void)loadResource:(NSString *) path callback:(ZegoMediaPlayerLoadResourceCallbacknullable ) callback;

Load media resource.

Parameters
path the absolute path of the local resource or the URL of the network resource
callback Notification of resource loading results

start

- (void)start:;

Start playing.

stop

- (void)stop:;

Stop playing.

pause

- (void)pause:;

Pause playing.

resume

- (void)resume:;

resume playing

seekTo:callback:

- (void)seekTo:(unsigned long long) millisecond callback:(ZegoMediaPlayerSeekToCallbacknullable ) callback;

Set the specified playback progress.

Parameters
millisecond Point in time of specified playback progress
callback the result notification of set the specified playback progress

enableRepeat:

- (void)enableRepeat:(BOOL) enable;

Whether to repeat playback.

Parameters
enable repeat playback flag. The default is NO.

enableAux:

- (void)enableAux:(BOOL) enable;

Whether to mix the player's sound into the stream being published.

Parameters
enable Aux audio flag. The default is NO.

muteLocal:

- (void)muteLocal:(BOOL) mute;

Whether to play locally silently.

Parameters
mute Mute local audio flag, The default is NO.

setPlayerCanvas:

- (void)setPlayerCanvas:(nullable ZegoCanvas *) canvas;

Set the view of the player playing video.

Parameters
canvas Video rendered canvas object

setVolume:

- (void)setVolume:(int) volume;

Set player volume.

Parameters
volume The range is 0 ~ 100. The default is 50.

setProgressInterval:

- (void)setProgressInterval:(unsigned long long) millisecond;

Set playback progress callback interval.

Parameters
millisecond Interval of playback progress callback in milliseconds