im.zego.zegoexpress.ZegoExpressEngine

Declared in ZegoExpressEngine.java

Package-Func Lists

Public-Static-Func Lists

  • createEngine - Create engine singleton instance.
  • destroyEngine - Destroy engine singleton object asynchronously.
  • getEngine - Returns engine singleton instance.
  • setEngineConfig - Set the advanced engine configuration, which will only take effect before create engine.
  • getVersion - Get SDK version number.

Public-Func Lists

Package-Func Docs

ZegoExpressEngine

package ZegoExpressEngine ()

Public-Static-Func Docs

createEngine

public ZegoExpressEngine createEngine (long appID, String appSign, boolean isTestEnv, ZegoScenario scenario, Application application, IZegoEventHandler eventHandler)

Create engine singleton instance.

Parameters
appID Application ID issued by ZEGO for developers, please apply from the ZEGO Admin Console . The value ranges from 0 to 4294967295.
appSign Application signature for each AppID, please apply from the ZEGO Admin Console. Application signature is a 64 character string. Each character has a range of '0' ~ '9', 'a' ~ 'z'.
isTestEnv Choose to use a test environment or a formal commercial environment, the formal environment needs to submit work order configuration in the ZEGO management console. The test environment is for test development, with a limit of 30 rooms and 230 users. Official environment App is officially launched. ZEGO will provide corresponding server resources according to the configuration records submitted by the developer in the management console. The test environment and the official environment are two sets of environments and cannot be interconnected.
scenario The application scenario. Developers can choose one of ZegoScenario based on the scenario of the app they are developing, and the engine will preset a more general setting for specific scenarios based on the set scenario. After setting specific scenarios, developers can still call specific api to set specific parameters if they have customized parameter settings.
application Android Application Context
eventHandler Event notification callback. [null] means not receiving any callback notifications.It can also be managed later via [setEventHandler]

destroyEngine

public void destroyEngine (IZegoDestroyCompletionCallback callback)

Destroy engine singleton object asynchronously.

Parameters
callback Notification callback for destroy engine completion. Developers can listen to this callback to ensure that device hardware resources are released. This callback is only used to notify the completion of the release of internal resources of the engine. Developers cannot release resources related to the engine within this callback. If the developer only uses SDK to implement audio and video functions, this parameter can be passed [null].

getEngine

public ZegoExpressEngine getEngine ()

Returns engine singleton instance.

setEngineConfig

public void setEngineConfig (ZegoEngineConfig config)

Set the advanced engine configuration, which will only take effect before create engine.

Parameters
config Advanced engine configuration

getVersion

public String getVersion ()

Get SDK version number.

Public-Func Docs

setEventHandler

public void setEventHandler (IZegoEventHandler eventHandler)

Set event notification callback, set [null] to clears the set callback.

Parameters
eventHandler Event notification callback. Developers should override callback related methods to focus on specific notifications based on their own business scenarios. The main callback methods of SDK are in [IZegoEventHandler].

uploadLog

public void uploadLog ()

Upload logs to ZEGO server.

setDebugVerbose

public void setDebugVerbose (boolean enable, ZegoLanguage language)

Set debug details switch and language.

Parameters
enable Detailed debugging information switch
language Debugging information language

loginRoom

public void loginRoom (String roomID, ZegoUser user)

Login room.

loginRoom

public void loginRoom (String roomID, ZegoUser user, ZegoRoomConfig config)

Login room.

logoutRoom

public void logoutRoom (String roomID)

Logout room.

Parameters
roomID Room ID, a string of up to 128 bytes in length. Only support numbers, English characters and '~', '!', '@', '#', '$', '', '^', '&', '*', '(', ')', '_', '+', '=', '-', ', ';', '’', ',', '.', '<', '>', '/', ''

startPublishingStream

public void startPublishingStream (String streamID)

Start publishing stream.

Parameters
streamID Stream ID, a string of up to 256 characters, needs to be globally unique within the entire AppID. If in the same AppID, different users publish each stream and the stream ID is the same, which will cause the user to publish the stream failure. You cannot include URL keywords, otherwise publishing stream and playing stream will fails. Only support numbers, English characters and '~', '!', '@', '#', '$', '', '^', '&', '*', '(', ')', '_', '+', '=', '-', ', ';', '’', ',', '.', '<', '>', '/', ''.

startPublishingStream

public void startPublishingStream (String streamID, ZegoPublishChannel channel)

Start publishing stream, you can call this api to publish the another stream.

Parameters
streamID Stream ID, a string of up to 256 characters, needs to be globally unique within the entire AppID. If in the same AppID, different users publish each stream and the stream ID is the same, which will cause the user to publish the stream failure. You cannot include URL keywords, otherwise publishing stream and playing stream will fails. Only support numbers, English characters and '~', '!', '@', '#', '$', '', '^', '&', '*', '(', ')', '_', '+', '=', '-', ', ';', '’', ',', '.', '<', '>', '/', ''.
channel Publish stream channel

stopPublishingStream

public void stopPublishingStream ()

Stop publishing stream.

stopPublishingStream

public void stopPublishingStream (ZegoPublishChannel channel)

Stop publishing stream of the specified channel.

Parameters
channel Publish stream channel

setStreamExtraInfo

public void setStreamExtraInfo (String extraInfo, IZegoPublisherSetStreamExtraInfoCallback callback)

Set stream extra information.

Parameters
extraInfo Stream extra information, a string of up to 1024 characters.
callback Set stream extra information execution result notification

setStreamExtraInfo

public void setStreamExtraInfo (String extraInfo, ZegoPublishChannel channel, IZegoPublisherSetStreamExtraInfoCallback callback)

Set stream additional information.

startPreview

public void startPreview (ZegoCanvas canvas)

Start/Update local preview.

Parameters
canvas The view used to display the preview image. If the view is set to null, no preview will be made.

startPreview

public void startPreview (ZegoCanvas canvas, ZegoPublishChannel channel)

Start/Update local preview.

stopPreview

public void stopPreview ()

Stop local preview.

stopPreview

public void stopPreview (ZegoPublishChannel channel)

Stop local preview.

Parameters
channel Publish stream channel

setVideoConfig

public void setVideoConfig (ZegoVideoConfig config)

Set up video configuration.

Parameters
config Video configuration, the SDK provides a common setting combination of resolution, frame rate and bit rate, they also can be customized.

setVideoConfig

public void setVideoConfig (ZegoVideoConfig config, ZegoPublishChannel channel)

Set up video configuration.

setVideoMirrorMode

public void setVideoMirrorMode (ZegoVideoMirrorMode mirrorMode)

Set mirror mode.

Parameters
mirrorMode Mirror mode for previewing or publishing the stream

setVideoMirrorMode

public void setVideoMirrorMode (ZegoVideoMirrorMode mirrorMode, ZegoPublishChannel channel)

Set mirror mode.

setAppOrientation

public void setAppOrientation (ZegoOrientation orientation)

Set the orientation of video.

Parameters
orientation Video orientation

setAppOrientation

public void setAppOrientation (ZegoOrientation orientation, ZegoPublishChannel channel)

Set the orientation of the captured video.

setAudioConfig

public void setAudioConfig (ZegoAudioConfig config)

set audio config

Parameters
config Audio config

mutePublishStreamAudio

public void mutePublishStreamAudio (boolean mute)

Stop or resume sending a audio stream.

Parameters
mute Whether to stop sending audio streams, true means that only the video stream is sent without sending the audio stream, and false means that the audio and video streams are sent simultaneously. The default is false.

mutePublishStreamAudio

public void mutePublishStreamAudio (boolean mute, ZegoPublishChannel channel)

Stop or resume sending a audio stream.

mutePublishStreamVideo

public void mutePublishStreamVideo (boolean mute)

Stop or resume sending a video stream.

Parameters
mute Whether to stop sending video streams, true means that only the audio stream is sent without sending the video stream, and false means that the audio and video streams are sent at the same time. The default is false.

mutePublishStreamVideo

public void mutePublishStreamVideo (boolean mute, ZegoPublishChannel channel)

Stop or resume sending a video stream.

enableTrafficControl

public void enableTrafficControl (boolean enable, int property)

Enable or disable traffic control.

Parameters
enable Whether to enable traffic control. The default is ture.
property Adjustable property of traffic control, bitmask format. Should be one or the combinations of [ZegoTrafficControlProperty] enumeration. [AdaptiveFPS] as default.

setMinVideoBitrateForTrafficControl

public void setMinVideoBitrateForTrafficControl (int bitrate, ZegoTrafficControlMinVideoBitrateMode mode)

Set the minimum video bitrate for traffic control.

Parameters
bitrate Minimum video bitrate (kbps)
mode Video sending mode below the minimum bitrate.

setCaptureVolume

public void setCaptureVolume (int volume)

Set the captured volume for publishing stream.

Parameters
volume Volume percentage. The range is 0 to 100. Default value is 100.

addPublishCdnUrl

public void addPublishCdnUrl (String streamID, String targetURL, IZegoPublisherUpdateCdnUrlCallback callback)

Add URL to relay to CDN.

Parameters
streamID Stream ID
targetURL CDN relay address, supported address format rtmp.
callback The execution result notification of the relay CDN operation, and proceed to the next step according to the execution result.

removePublishCdnUrl

public void removePublishCdnUrl (String streamID, String targetURL, IZegoPublisherUpdateCdnUrlCallback callback)

Delete the URL relayed to the CDN.

Parameters
streamID Stream ID
targetURL CDN relay address, supported address format rtmp, flv, hls
callback Remove CDN relay result notifications

enablePublishDirectToCDN

public void enablePublishDirectToCDN (boolean enable, ZegoCDNConfig config)

Whether to publish stream directly to CDN without passing through Zego real-time video cloud server.

Parameters
enable Whether to enable direct publish CDN, true: enable direct publish CDN, false: disable direct publish CDN
config CDN configuration, if null, use Zego's background default configuration

enablePublishDirectToCDN

public void enablePublishDirectToCDN (boolean enable, ZegoCDNConfig config, ZegoPublishChannel channel)

Whether to publish stream directly to CDN without passing through Zego real-time video cloud server.

setPublishWatermark

public void setPublishWatermark (ZegoWatermark watermark, boolean isPreviewVisible)

Set publish watermark.

Parameters
watermark The upper left corner of the watermark layout is the origin of the coordinate system, and the area cannot exceed the size set by the encoding resolution. If it is null, the watermark is cancelled.
isPreviewVisible the watermark is visible on local preview

setPublishWatermark

public void setPublishWatermark (ZegoWatermark watermark, boolean isPreviewVisible, ZegoPublishChannel channel)

Set publish watermark.

sendSEI

public void sendSEI (byte[] data)

Send SEI.

Parameters
data SEI data

sendSEI

public void sendSEI (byte[] data, ZegoPublishChannel channel)

Send SEI.

enableHardwareEncoder

public void enableHardwareEncoder (boolean enable)

On/off hardware encoding.

Parameters
enable Whether to enable hardware encoding, true: enable hardware encoding, false: disable hardware encoding

setCapturePipelineScaleMode

public void setCapturePipelineScaleMode (ZegoCapturePipelineScaleMode mode)

set capture pipeline scale mode.

startPlayingStream

public void startPlayingStream (String streamID, ZegoCanvas canvas)

Start playing stream.

Parameters
streamID Stream ID, a string of up to 256 characters. You cannot include URL keywords, otherwise publishing stream and playing stream will fails. Only support numbers, English characters and '~', '!', '@', '#', '$', '', '^', '&', '*', '(', ')', '_', '+', '=', '-', ', ';', '’', ',', '.', '<', '>', '/', ''.
canvas The view used to display the play audio and video stream's image. If the view is set to [null], it will not be displayed.

startPlayingStream

public void startPlayingStream (String streamID, ZegoCanvas canvas, ZegoPlayerConfig config)

Start playing stream.

Parameters
streamID Stream ID, a string of up to 256 characters. You cannot include URL keywords, otherwise publishing stream and playing stream will fails. Only support numbers, English characters and '~', '!', '@', '#', '$', '', '^', '&', '*', '(', ')', '_', '+', '=', '-', ', ';', '’', ',', '.', '<', '>', '/', ''.
canvas The view used to display the play audio and video stream's image. If the view is set to [null], it will not be displayed.
config Advanced player configuration

stopPlayingStream

public void stopPlayingStream (String streamID)

Stop playing stream.

Parameters
streamID Stream ID

setPlayVolume

public void setPlayVolume (String streamID, int volume)

Set the playback volume of the stream.

Parameters
streamID Stream ID
volume Volume percentage. The value ranges from 0 to 100, and the default value is 100.

mutePlayStreamAudio

public void mutePlayStreamAudio (String streamID, boolean mute)

Stop/resume playing the audio data of the stream.

Parameters
streamID Stream ID
mute mute flag, true: mute play stream video, false: resume play stream video

mutePlayStreamVideo

public void mutePlayStreamVideo (String streamID, boolean mute)

Stop/resume playing the video data of the stream.

Parameters
streamID Stream ID
mute mute flag, true: mute play stream video, false: resume play stream video

enableHardwareDecoder

public void enableHardwareDecoder (boolean enable)

On/off hardware decoding.

Parameters
enable Whether to turn on hardware decoding switch, true: enable hardware decoding, false: disable hardware decoding. The default is false

enableCheckPoc

public void enableCheckPoc (boolean enable)

On/off frame order detection.

Parameters
enable Whether to turn on frame order detection, true: enable check poc,not support B frames, false: disable check poc, support B frames but the screen may temporary splash. The default is true

startMixerTask

public void startMixerTask (ZegoMixerTask task, IZegoMixerStartCallback callback)

Start mix stream task.

Parameters
task Mix stream task object
callback Start mix stream task result callback notification

stopMixerTask

public void stopMixerTask (ZegoMixerTask task, IZegoMixerStopCallback callback)

Stop mix stream task.

Parameters
task Mix stream task object
callback Stop mix stream task result callback notification

muteMicrophone

public void muteMicrophone (boolean mute)

Whether to mute microphone input.

Parameters
mute Whether to turn off the microphone, true: turn off microphone, false: turn on microphone. The default is true.

muteSpeaker

public void muteSpeaker (boolean mute)

Whether to mute speaker output.

Parameters
mute Whether to disable audio output to the device, true: disable audio output, false: enable audio output. The default value is false

enableAudioCaptureDevice

public void enableAudioCaptureDevice (boolean enable)

On/off audio capture device.

Parameters
enable Whether to enable the audio capture device, true: disable audio capture device, false: enable audio capture device

setBuiltInSpeakerOn

public void setBuiltInSpeakerOn (boolean enable)

Whether to use the built-in speaker to play sound.

Parameters
enable Whether to use the built-in speaker to play sound, true: use the built-in speaker to play sound, false: use the highest priority audio output device scheduled by the current system to play sound

enableCamera

public void enableCamera (boolean enable)

On/off camera.

Parameters
enable Whether to turn on the camera, true: turn on camera, false: turn off camera

enableCamera

public void enableCamera (boolean enable, ZegoPublishChannel channel)

On/off camera.

useFrontCamera

public void useFrontCamera (boolean enable)

Switch front and rear camera.

Parameters
enable Whether to use the front camera, true: use the front camera, false: use the the rear camera. The default value is true

useFrontCamera

public void useFrontCamera (boolean enable, ZegoPublishChannel channel)

Switch front and rear camera.You can call this api to set params when publishing another streams.

Parameters
enable Whether to use the front camera, true: use the front camera, false: use the the rear camera. The default value is true
channel Publishing stream channel.

startSoundLevelMonitor

public void startSoundLevelMonitor ()

Start the sound level monitor.

stopSoundLevelMonitor

public void stopSoundLevelMonitor ()

Stop the sound level monitor.

startAudioSpectrumMonitor

public void startAudioSpectrumMonitor ()

Start the audio spectrum monitor.

stopAudioSpectrumMonitor

public void stopAudioSpectrumMonitor ()

Stop the audio spectrum monitor.

enableAEC

public void enableAEC (boolean enable)

On/off echo cancellation.

Parameters
enable Whether to enable echo cancellation, true: enable echo cancellation, false: disable echo cancellation

setAECMode

public void setAECMode (ZegoAECMode mode)

Set echo cancellation mode.

Parameters
mode Echo cancellation mode

enableAGC

public void enableAGC (boolean enable)

On/off automatic gain control.

Parameters
enable Whether to enable automatic gain control, true: enable AGC, false: disable AGC

enableANS

public void enableANS (boolean enable)

On/off noise suppression.

Parameters
enable Whether to enable noise suppression, true: enable AGC, false: disable AGC

enableBeautify

public void enableBeautify (int featureBitmask)

On/off beauty.

Parameters
featureBitmask Beauty features, bitmask format, you can choose to enable several features in [ZegoBeautifyFeature] at the same time

enableBeautify

public void enableBeautify (int featureBitmask, ZegoPublishChannel channel)

On/off beauty.

Parameters
featureBitmask Beauty features, bitmask format, you can choose to enable several features in [ZegoBeautifyFeature] at the same time
channel Publishing stream channel.

setBeautifyOption

public void setBeautifyOption (ZegoBeautifyOption option)

Set beauty parameters.

Parameters
option Beauty configuration options

setBeautifyOption

public void setBeautifyOption (ZegoBeautifyOption option, ZegoPublishChannel channel)

Set beauty parameters.

Parameters
option Beauty configuration options
channel Publishing stream channel.

sendBroadcastMessage

public void sendBroadcastMessage (String roomID, String message, IZegoIMSendBroadcastMessageCallback callback)

Send room broadcast message.

Parameters
roomID Room ID, a string of up to 128 bytes in length. Only support numbers, English characters and '~', '!', '@', '#', '$', '', '^', '&', '*', '(', ')', '_', '+', '=', '-', ', ';', '’', ',', '.', '<', '>', '/', ''
message Message content, no longer than 256 bytes
callback Send broadcast message result callback

sendBarrageMessage

public void sendBarrageMessage (String roomID, String message, IZegoIMSendBarrageMessageCallback callback)

Send room barrage message.

Parameters
roomID Room ID, a string of up to 128 bytes in length. Only support numbers, English characters and '~', '!', '@', '#', '$', '', '^', '&', '*', '(', ')', '_', '+', '=', '-', ', ';', '’', ',', '.', '<', '>', '/', ''
message Message content, no longer than 256 bytes
callback Send barrage message result callback

sendCustomCommand

public void sendCustomCommand (String roomID, String command, ArrayList< ZegoUser > toUserList, IZegoIMSendCustomCommandCallback callback)

Send custom command.

Parameters
roomID Room ID, a string of up to 128 bytes in length. Only support numbers, English characters and '~', '!', '@', '#', '$', '', '^', '&', '*', '(', ')', '_', '+', '=', '-', ', ';', '’', ',', '.', '<', '>', '/', ''
command Custom command content, no longer than 256 bytes
toUserList The users who will receive the command
callback Send command result callback

createMediaPlayer

public ZegoMediaPlayer createMediaPlayer ()

Create a media player instance object.

destroyMediaPlayer

public void destroyMediaPlayer (ZegoMediaPlayer mediaPlayer)

Destroy a media player instance object.

Parameters
mediaPlayer The media player instance object to be destroyed

setCustomVideoRenderHandler

public void setCustomVideoRenderHandler (IZegoCustomVideoRenderHandler handler)

Set the custom video render handler.

Parameters
handler Custom video render handler

setCustomVideoCaptureHandler

public void setCustomVideoCaptureHandler (IZegoCustomVideoCaptureHandler handler)

Set the custom video capture handler.

Parameters
handler Custom video capture handler

sendCustomVideoCaptureRawData

public void sendCustomVideoCaptureRawData (ByteBuffer data, int dataLength, ZegoVideoFrameParam params, long referenceTimeMillisecond)

Send captured video data to SDK.

Parameters
data video frame data
dataLength video frame data length
params video frame param
referenceTimeMillisecond video frame reference time

sendCustomVideoCaptureRawData

public void sendCustomVideoCaptureRawData (ByteBuffer data, int dataLength, ZegoVideoFrameParam params, long referenceTimeMillisecond, ZegoPublishChannel channel)

Send captured video data to SDK.

sendCustomVideoCaptureTextureData

public void sendCustomVideoCaptureTextureData (int textureID, int width, int height, double referenceTimeMillisecond)

Send texture video frame data to SDK.

Parameters
textureID texture ID
width Video frame width
height Video frame height
referenceTimeMillisecond Timestamp of this video frame

sendCustomVideoCaptureTextureData

public void sendCustomVideoCaptureTextureData (int textureID, int width, int height, double referenceTimeMillisecond, ZegoPublishChannel channel)

Send texture video frame data to SDK.

getCustomVideoCaptureSurfaceTexture

public SurfaceTexture getCustomVideoCaptureSurfaceTexture ()

Get SurfaceTexture instance.

setCustomVideoCaptureFillMode

public void setCustomVideoCaptureFillMode (ZegoViewMode mode)

Set custom video capture fill mode.

Parameters
mode View mode

setCustomVideoCaptureFillMode

public void setCustomVideoCaptureFillMode (ZegoViewMode mode, ZegoPublishChannel channel)

Set custom video capture fill mode.