Package im.zego.zegoexpress.internal
Class ZegoMediaDataInternalImpl
- java.lang.Object
-
- im.zego.zegoexpress.ZegoMediaDataPublisher
-
- im.zego.zegoexpress.internal.ZegoMediaDataInternalImpl
-
public final class ZegoMediaDataInternalImpl extends ZegoMediaDataPublisher
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.HashMap<java.lang.Integer,im.zego.zegoexpress.internal.ZegoMediaDataInternalImpl.PublisherAndHandler>
mediaDataInternalHandler
static android.os.Handler
mUIHandler
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMediaFilePath(java.lang.String path, boolean is_clear)
Add media file to the publish queue.static ZegoMediaDataPublisher
createMediaDataPublisher(int mode, int channel)
static void
destroyMediaDataPublisher(ZegoMediaDataPublisher mediaDataPublisher)
long
getCurrentDuration()
Get the playing progress of the current file.int
getIndex()
Get the channel index of the media data publisher.long
getTotalDuration()
Get the total duration of the current file.void
reset()
Clear all the status in this media data publisher, so that it can be restarted next time.void
seekTo(long millisecond)
Specify the starting point of the current video file publishing.void
setEventHandler(IZegoMediaDataPublisherEventHandler handler)
Set event callback handler for the media data publisher.void
setVideoSendDelayTime(int delayTime)
Set the delay time of video playback.
-
-
-
Method Detail
-
createMediaDataPublisher
public static ZegoMediaDataPublisher createMediaDataPublisher(int mode, int channel)
-
destroyMediaDataPublisher
public static void destroyMediaDataPublisher(ZegoMediaDataPublisher mediaDataPublisher)
-
addMediaFilePath
public void addMediaFilePath(java.lang.String path, boolean is_clear)
Description copied from class:ZegoMediaDataPublisher
Add media file to the publish queue. Currently, only mp4 / m4a / aac files are supported, and special conversion is required. Available since: 2.17.0 Description: 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.- Specified by:
addMediaFilePath
in classZegoMediaDataPublisher
- Parameters:
path
- Local absolute path to the media file.is_clear
- Whether to clear the publish queue.
-
reset
public void reset()
Description copied from class:ZegoMediaDataPublisher
Clear all the status in this media data publisher, so that it can be restarted next time. Available since: 2.17.0 Description: 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.- Specified by:
reset
in classZegoMediaDataPublisher
-
setVideoSendDelayTime
public void setVideoSendDelayTime(int delayTime)
Description copied from class:ZegoMediaDataPublisher
Set the delay time of video playback. Available since: 2.17.0 Description: 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.- Specified by:
setVideoSendDelayTime
in classZegoMediaDataPublisher
- Parameters:
delayTime
- Video playback time.Required: Yes.Value range: [0, 100] ms.
-
seekTo
public void seekTo(long millisecond)
Description copied from class:ZegoMediaDataPublisher
Specify the starting point of the current video file publishing. Available since: 2.17.0 Description: 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.- Specified by:
seekTo
in classZegoMediaDataPublisher
- Parameters:
millisecond
- The 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
-
getTotalDuration
public long getTotalDuration()
Description copied from class:ZegoMediaDataPublisher
Get the total duration of the current file. Available since: 2.17.0 Description: Get the total duration of the current file, in milliseconds. When to call: After [onMediaDataPublisherFileDataBegin] callback.- Specified by:
getTotalDuration
in classZegoMediaDataPublisher
- Returns:
- The total duration of the current file.
-
getCurrentDuration
public long getCurrentDuration()
Description copied from class:ZegoMediaDataPublisher
Get the playing progress of the current file. Available since: 2.17.0 Description: Get the playing progress of the current file, in milliseconds. When to call: After received the [onMediaDataPublisherFileDataBegin] callback.- Specified by:
getCurrentDuration
in classZegoMediaDataPublisher
- Returns:
- The playing progress of the current file.
-
setEventHandler
public void setEventHandler(IZegoMediaDataPublisherEventHandler handler)
Description copied from class:ZegoMediaDataPublisher
Set event callback handler for the media data publisher. Available since: 2.17.0 Description: 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+](https://docs.zegocloud.com/en/16413.html).- Specified by:
setEventHandler
in classZegoMediaDataPublisher
- Parameters:
handler
- The event handler
-
getIndex
public int getIndex()
Description copied from class:ZegoMediaDataPublisher
Get the channel index of the media data publisher. Available since: 3.4.0 Description: Get the channel index of the media data publisher.- Specified by:
getIndex
in classZegoMediaDataPublisher
-
-