All Products
Search
Document Center

:API reference

Last Updated:Mar 22, 2024

This topic describes the classes and methods that are provided by Push SDK for Android.

Basic classes

Class

Description

AlivcLiveBase

The base class for 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 background music.

AlivcLivePlayer

The abstract class for stream pulling.

AlivcLivePlayConfig

The class used to initialize the stream pulling configurations.

AlivcLivePlayInfoListener

The class for stream pulling callbacks.

Basic methods related to stream ingest

AlivcLiveBase

Method

Description

getSDKVersion

Queries the version number of Push SDK for Android.

isSupportLiveMode

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

registerSDK

Registers a license for the SDK.

setConsoleEnabled

Enables or disables logging for 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 generating all logs, the performance of the application may deteriorate.

Methods related to stream ingest features

AlivcLivePusher

Method

Description

init

Initializes the stream ingest parameters.

destroy

Destroys the stream ingest.

startPreview

Starts the preview. In interactive mode, call the startPreview method in which you specify the FrameLayout parameter.

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

Specifies whether to enable autofocus.

focusCameraAtAdjustedPoint

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

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

Sets the callback for custom face recognition.

setCustomFilter

Sets the callback for custom retouching.

setCustomAudioFilter

Sets 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 screen orientation for stream ingest. 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.

startIntelligentDenoise

Enables intelligent noise reduction.

stopIntelligentDenoise

Disables intelligent noise reduction.

setQualityMode

Sets the video resolution.

setPreviewMode

Sets the preview mode.

pauseScreenCapture

Pauses screen recording during stream ingest with privacy protection enabled.

resumeScreenCapture

Resumes screen 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 upper left vertex of a watermark are ([0,Screen width),[0,Screen height)). The value range of the watermark width is (0,Screen width]. You can call this method after you call the startPreview method.

setWatermarkVisible

Specifies whether to make watermarks visible.

startCamera

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

stopCamera

Disables the camera preview during screen recording.

setScreenOrientation

Sets the angle for screen rotation during screen recording.

startCameraMix

Enables the camera mixing during screen recording.

stopCameraMix

Disables the camera mixing during screen recording.

snapshot

Captures snapshots of the video stream.

inputStreamVideoPtr

Specifies the pointer for the custom video stream.

inputStreamVideoData

Specifies the data for the custom video stream.

inputStreamAudioPtr

Specifies the pointer for the custom audio stream.

inputStreamAudioData

Specifies the data for the custom audio stream.

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 supplemental enhancement information (SEI) messages on the stream ingest side.

setLiveMixTranscodingConfig

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

getLiveTraceId

Queries the trace ID of the live streaming.

Methods related to stream pulling

AlivcLivePlayer

Note

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

Method

Description

setupWithConfig

Initializes stream pulling parameters.

setPlayView

Sets the playback view.

setPlayInfoListener

Sets the listener for notifications about stream pulling.

setPlayoutVolume

Sets the playback volume.

startPlay

Starts the playback of the audio and video streams.

stopPlay

Stops the playback of the audio and video streams.

pauseAudioPlaying

Pauses the playback of the audio stream.

pauseVideoPlaying

Pauses the playback of the video stream.

resumeAudioPlaying

Resumes the playback of the audio stream.

resumeVideoPlaying

Resumes the playback of the video stream.

destroy

Destroys the stream pulling.

getMode

Queries the current stream pulling mode.

Methods related to stream ingest callbacks

AlivcLiveBaseListener

Method

Description

onLicenceCheck

The asynchronous callback for the authentication results of SDK licenses.

AlivcLivePushErrorListener

Method

Description

onSDKError

The callback for SDK errors.

onSystemError

The callback for system errors.

AlivcLivePushNetworkListener

Method

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 stream ingest.

onPushURLAuthenticationOverdue

The authentication expires.

onReconnectFail

The reconnection fails.

onReconnectStart

The reconnection starts.

onReconnectSucceed

The reconnection succeeds.

onSendDataTimeout

The data transmission times out.

onSendMessage

An SEI message is sent.

AlivcLivePushInfoListener

Method

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 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

Method

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

Method

Description

onError

The callback for errors.

onFirstVideoFrameDrawn

The callback for the playback of the video.

onPlayStarted

The callback for the start of the playback.

onPlayStopped

The callback for the end of the playback.