logo
On this page

ZegoMediaDataPublisher

ZegoMediaDataPublisher

Declared in ZegoExpressDefines.h

Methods

setEventHandler:

setEventHandler:
- (void)setEventHandler:(nullable id<ZegoMediaDataPublisherEventHandler>) handler;
Set event callback handler for the media data publisher.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
handlernullable id<ZegoMediaDataPublisherEventHandler>The event handler

Details

Set event callback handler for media data publisher.

  • Use cases: Often used in server-side publishing stream scenarios, such as AI classrooms.
  • When to call: After calling the [createMediaDataPublisher] function to create a media data publisher.
  • Caution: This API used to be named [setMediaDataPublisherEventHandler] before version 3.8.0. Please refer to Upgrade guide v3.8.0+.
  • Available since: 2.17.0

addMediaFilePath:isClear:

addMediaFilePath:isClear:
- (void)addMediaFilePath:(NSString *) path isClear:(BOOL) isClear;
Add media file to the publish queue. Currently, only mp4 / m4a / aac files are supported, and special conversion is required.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
pathNSString *Local absolute path to the media file.
isClearBOOLWhether to clear the publish queue.

Details

Add media file to the publish queue. Currently, only mp4 / m4a / aac file are supported, and special conversion is required.

  • Use cases: Often used in server-side publishing stream scenarios, such as AI classrooms.
  • When to call: After calling the [createMediaDataPublisher] function to create a media data publisher.
  • Caution: The mp4 file format must meet the following points:The video must be encoded as H.264 and cannot contain B frames, only I and P frames. The I frame interval is 2s, that is, a single GOP value is 2s; The frame rate, bit rate, and resolution of the video are consistent with the frame rate, bit rate, and resolution set by [setVideoConfig] before publishing stream; Audio encoding must be MPEG-4 AAC.
  • Available since: 2.17.0

reset

reset
- (void)reset;
Clear all the status in this media data publisher, so that it can be restarted next time.
Declared in ZegoExpressDefines.h

When you need to re-publish stream and do not need to continue publishing from the previous publish queue, you can call this function to reset this media data publisher's state.

  • Use cases: Often used in server-side publishing stream scenarios, such as AI classrooms.
  • Caution: When the developer calls [logoutRoom], the state is automatically reset.
  • Available since: 2.17.0

setVideoSendDelayTime:

setVideoSendDelayTime:
- (void)setVideoSendDelayTime:(int) delayTime;
Set the delay time of video playback.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
delayTimeintVideo playback time.Required: Yes.Value range: [0, 100] ms.

Details

When this value is set, when publishing video file stream, the SDK will permanently delay the video to the set time value before sending.

  • Use cases: Mainly used to correct the fixed audio and picture asynchronous phenomenon that occurs during streaming.
  • When to call: After calling the [createMediaDataPublisher] function to create a media data publisher.
  • Available since: 2.17.0

seekTo:

seekTo:
- (void)seekTo:(unsigned long long) millisecond;
Specify the starting point of the current video file publishing.
Declared in ZegoExpressDefines.h

Parameters

NameTypeDescription
millisecondunsigned long longThe timestamp of the start of streaming (relative to the timestamp of the file currently being published, the starting value is 0). the unit is milliseconds

Details

Specify the starting point of the current video file publishing.

  • When to call: Called at any point between [OnMediaDataPublisherFileOpen] and [OnMediaDataPublisherFileClose]. For example: this function can be called directly in the [OnMediaDataPublisherFileOpen] callback.
  • Available since: 2.17.0

getTotalDuration

getTotalDuration
- (unsigned long long)getTotalDuration;
Get the total duration of the current file.
Declared in ZegoExpressDefines.h

Get the total duration of the current file, in milliseconds.

  • When to call: After [onMediaDataPublisherFileDataBegin] callback.
  • Available since: 2.17.0

The total duration of the current file.

getCurrentDuration

getCurrentDuration
- (unsigned long long)getCurrentDuration;
Get the playing progress of the current file.
Declared in ZegoExpressDefines.h

Get the playing progress of the current file, in milliseconds.

  • When to call: After received the [onMediaDataPublisherFileDataBegin] callback.
  • Available since: 2.17.0

The playing progress of the current file.

getIndex

getIndex
- (NSNumber *)getIndex;
Get the channel index of the media data publisher.
Declared in ZegoExpressDefines.h

Get the channel index of the media data publisher.

  • Available since: 3.4.0

Previous

zegologconfig

Next

zegomediadatapublisherconfig

On this page

Back to top