All Products
Search
Document Center

:API reference for Push SDK

Last Updated:Mar 17, 2023

This topic describes the API operations that are related to Push SDK.

Basic functions

API operation

Description

AlivcLiveBase

The class for the basic operations related to stream ingest.

AlivcLivePusher

The class for stream ingest features.

AlivcLivePushConfig

The class used to initialize the stream ingest configurations.

AlivcLivePushErrorListener

The class for error listeners for stream ingest.

AlivcLivePushNetworkListener

The class for network listeners for stream ingest.

AlivcLivePushInfoListener

The class for notification listeners for stream ingest.

AlivcLiveBaseListener

The class for stream ingest callbacks.

AlivcLivePushBGMListener

The class for notification listeners for the playback of stream ingest.

AlivcLivePlayer

The class for stream pulling operations.

AlivcLivePlayConfig

The class used to initialize the stream pulling configurations.

AlivcLivePlayInfoListener

The class for stream pulling callbacks.

Basic API operations related to stream ingest

AlivcLiveBase

API operation

Description

getSDKVersion

Queries the version number of the SDK.

isSupportLiveMode

Queries whether the stream ingest mode is supported by the SDK.

registerSDK

Registers a license for the SDK.

setConsoleEnabled

Specifies whether to enable the logging feature in the console.

setListener

Specifies whether to enable callback notifications to asynchronously receive the license registration results.

setLogDirPath

Specifies the path in which log files are stored and the size of log shards. Make sure that the path exists and data can be written to the path.

setLogLevel

Specifies the log level.

Important

If you enable the feature for periodically copying all the log files to another directory, the performance of the application may deteriorate.

API operations related to stream ingest features

AlivcLivePusher

API operation

Description

init

Initializes the stream ingest parameters.

destroy

Stops the stream ingest.

startPreview

Starts the preview. In interactive mode, call the startPreview operation in which the FrameLayout parameter is specified.

startPreviewAysnc

Asynchronously starts the preview.

stopPreview

Stops the preview.

startPush

Starts the stream ingest.

startPushAysnc

Asynchronously starts the stream ingest.

restartPush

Restarts the stream ingest.

restartPushAync

Asynchronously restarts the stream ingest.

reconnectPushAsync

Reconnects and starts the stream ingest.

stopPush

Stops the stream ingest.

pause

Pauses the stream ingest.

resume

Resumes the stream ingest.

resumeAsync

Asynchronously resumes the stream ingest.

switchCamera

Switches between the front and rear cameras.

setAutoFocus

Sets auto focus.

focusCameraAtAdjustedPoint

Configures focus. The coordinates of the focus point are ([0,Screen width],[0,Screen width]).

setZoom

Sets the zoom factor. Valid values: [0,getMaxZoom()].

getMaxZoom

Queries the maximum zoom factor supported by the camera.

  • A value of 0 indicates that zooming is not supported.

  • A value that is greater than 0 indicates the maximum zoom factor.

getCurrentZoom

Queries the current zoom factor.

setMute

Specifies whether to mute the audio during stream ingest.

setFlash

Specifies whether to enable the flash.

setPushMirror

Specifies whether to enable mirroring for stream ingest.

setPreviewMirror

Specifies whether to enable mirroring preview.

setTargetVideoBitrate

Sets the bitrate to be used after video encoding in the range from 100 to 5000. Unit: Kbit/s.

setMinVideoBitrate

Sets the minimum bitrate of the video after encoding in the range from 100 to 5000. Unit: Kbit/s.

isCameraSupportAutoFocus

Queries whether autofocus is supported.

isCameraSupportFlash

Queries whether the flash is supported.

isPushing

Queries whether a stream is being ingested.

isNetworkPushing

Queries the current network status of stream ingest.

setCustomDetect

Configures the callback for custom face recognition.

setCustomFilter

Configures the callback for custom filters.

setCustomAudioFilter

Configures the callback for custom audio processing.

getCurrentStatus

Queries the current status.

setLivePushErrorListener

Sets the listener for errors related to stream ingest.

setLivePushInfoListener

Sets the listener for notifications about stream ingest.

setLivePushNetworkListener

Sets the listener for notifications about the network.

setLivePushBGMListener

Sets the listener for notifications about the playback of background music.

setLivePushRenderContextListener

Sets the listener for the rendering context.

getLivePushStatsInfo

Queries the statistics on stream ingest.

getPushUrl

Queries the ingest URL.

setPreviewOrientation

Sets the stream ingest mode. By default, streams are ingested in portrait mode.

setAudioEffectVoiceChangeMode

Sets the voice change mode.

setAudioEffectReverbMode

Sets the reverberation mode.

startBGMAsync

Starts the playback of background music.

stopBGMAsync

Stops the playback of background music.

pauseBGM

Pauses the playback of background music.

resumeBGM

Resumes the playback of background music.

setBGMLoop

Specifies whether to enable loop playback for background music.

setBGMEarsBack

Specifies whether to enable in-ear monitoring.

setBGMVolume

Sets the music volume for the mixed background music.

setCaptureVolume

Sets the voice volume for the mixed background music

setAudioDenoise

Specifies whether to enable noise reduction for audio.

startIntelligentDenoise

Enables intelligent noise reduction for audio.

stopIntelligentDenoise

Disables intelligent noise reduction for audio.

setQualityMode

Sets the video resolution.

setPreviewMode

Sets the preview mode.

pauseScreenCapture

Pauses recording during stream ingest with privacy protection enabled.

resumeScreenCapture

Resumes recording during stream ingest with privacy protection disabled.

getLastError

Queries the recently returned error codes.

changeResolution

Dynamically adjusts the video resolution.

addWaterMark

Adds a watermark. You can add up to three watermarks. The coordinates of the initial position are ([0,width),[0,height)). The value range of the width is (0,width]. You can call this operation after you call the startPreview operation.

setWatermarkVisible

Specifies whether to make watermarks visible.

startCamera

Enables the camera preview during recording. If the preview is not required, set the surfaceview parameter to null.

stopCamera

Disables the camera preview during recording.

setScreenOrientation

Sets the rotation angle for the screen during recording.

startCameraMix

Enables the camera mixing during recording.

stopCameraMix

Disables the camera mixing during recording.

snapshot

Captures snapshots of the video stream.

inputStreamVideoPtr

Specifies the data for custom video streams.

inputStreamVideoData

Specifies the data for custom video streams.

inputStreamAudioPtr

Specifies the data for custom audio streams.

inputStreamAudioData

Specifies the data for custom audio streams.

addDynamicsAddons

Adds an animated sticker.

removeDynamicsAddons

Removes an animated sticker.

setExposure

Sets the exposure value for the camera.

getCurrentExposure

Queries the exposure value of the camera.

getSupportedMinExposure

Queries the minimum exposure value supported by the camera.

getSupportedMaxExposure

Queries the maximum exposure value supported by the camera.

sendMessage

Sends custom messages of supplemental enhancement information (SEI) on the stream ingest client.

setLiveMixTranscodingConfig

Sets the transcoding parameters for the mixed streams in the cloud.

getLiveTraceId

Queries the trace ID of the live streaming.

API operations related to streaming pulling features

AlivcLivePlayer

Note

This class is available only for pulling streams in interactive mode.

API operation

Description

setupWithConfig

Initializes stream pulling parameters.

setPlayView

Sets the playback preview.

setPlayInfoListener

Sets the listener for notifications about stream pulling.

setPlayoutVolume

Sets the playback volume.

startPlay

Starts the playback of audio and video streams.

stopPlay

Stops the playback of audio and video streams.

pauseAudioPlaying

Pauses the playback of audio streams.

pauseVideoPlaying

Pauses the playback of video streams.

resumeAudioPlaying

Resumes the playback of audio streams.

resumeVideoPlaying

Resumes the playback of video streams.

destroy

Stops the stream pulling.

getMode

Queries the current stream pulling mode.

API operations related to callbacks

AlivcLiveBaseListener

API operation

Description

onLicenceCheck

The asynchronous callback for the authentication results of SDK licenses.

AlivcLivePushErrorListener

API operation

Description

onSDKError

The callback for SDK errors.

onSystemError

The callback for system errors.

AlivcLivePushNetworkListener

API operation

Description

onConnectFail

The connection fails.

onConnectionLost

The connection is interrupted.

onNetworkPoor

The network condition is poor.

onNetworkRecovery

The network recovers.

onPacketsLost

The callback for packet loss during the stream ingest.

onPushURLAuthenticationOverdue

The authentication expires.

onReconnectFail

The reconnection fails.

onReconnectStart

The reconnection starts.

onReconnectSucceed

The reconnection succeeded.

onSendDataTimeout

The data transmission times out.

onSendMessage

An SEI message is sent.

AlivcLivePushInfoListener

API operation

Description

onAdjustBitRate

The bitrate is adjusted.

onAdjustFps

The frame rate is adjusted.

onDropFrame

Frames drop.

onFirstAVFramePushed

The first audio and video packet is sent.

onFirstFramePreviewed

The first frame is rendered.

onPreviewStarted

The preview starts.

onPreviewStoped

The preview ends.

onPushPaused

The stream ingest pauses.

onPushRestarted

The stream ingest restarts.

onPushResumed

The stream ingest resumes.

onPushStarted

The stream ingest starts.

onPushStatistics

The callback for data statistics on the stream ingest. This callback is returned every 2 seconds.

onPushStoped

The stream ingest ends.

onSetLiveMixTranscodingConfig

The callback for configurations of transcoding parameters for mixed streams in the cloud.

AlivcLivePushBGMListener

API operation

Description

onCompleted

The playback ends.

onDownloadTimeout

The player times out. The player is reconnected and seeks the previous playback position.

onOpenFailed

The stream is invalid, which indicates the stream is inaccessible.

onPaused

The playback pauses.

onProgress

The playback progress is updated.

onResumed

The playback resumes.

onStarted

The playback starts.

onStoped

The playback stops.

AlivcLivePlayInfoListener

API operation

Description

onError

The callback for errors.

onFirstVideoFrameDrawn

The callback for the playback of videos.

onPlayStarted

The callback for the start of the playback.

onPlayStopped

The callback for the end of the playback.