This topic describes the methods provided by Push SDK for Android.
API references
Click the following links to view the API documentation of different SDK versions. The API documentation is also available in the SDK package.
Interactive edition
v6.17.0 (latest)
Basic edition
v6.17.0 (latest)
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 the error listener for stream ingest. | ||||||
AlivcLivePushNetworkListener | The class for the network listener for stream ingest. | ||||||
AlivcLivePushInfoListener | The class for the notification listener for stream ingest. | ||||||
AlivcLiveBaseListener | The class for stream ingest callbacks. | ||||||
AlivcLivePushBGMListener | The class for the notification listener 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. |
AlivcLiveBase - provides basic methods related to stream ingest
Method | Description | ||||||
getSDKVersion | Queries the version number of the SDK. | ||||||
isSupportLiveMode | Queries the stream ingest modes supported by the SDK. | ||||||
registerSDK | Registers a license for the SDK. | ||||||
setConsoleEnabled | Specifies whether to enable log printing 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 all logs, the performance of the application may deteriorate. |
AlivcLivePusher - provides methods related to stream ingest features
Method | Description | ||||||
init | Initializes stream ingest parameters. | ||||||
destroy | Destroys the stream ingest engine. | ||||||
startPreview | Starts preview. In interactive mode, call the startPreview method in which you specify the FrameLayout parameter. | ||||||
startPreviewAysnc | Asynchronously starts preview. | ||||||
stopPreview | Stops preview. | ||||||
startPush | Starts stream ingest. | ||||||
startPushAysnc | Asynchronously starts stream ingest. | ||||||
restartPush | Restarts stream ingest. | ||||||
restartPushAync | Asynchronously restarts stream ingest. | ||||||
reconnectPushAsync | Reconnects and continues stream ingest. | ||||||
stopPush | Stops stream ingest. | ||||||
pause | Pauses stream ingest. | ||||||
resume | Resumes stream ingest. | ||||||
resumeAsync | Asynchronously resumes stream ingest. | ||||||
switchCamera | Switches between the front and rear cameras. | ||||||
setAutoFocus | Specifies whether to enable autofocus. | ||||||
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.
| ||||||
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 the mirroring mode for stream ingest. | ||||||
setPreviewMirror | Specifies whether to enable the mirroring mode for preview. | ||||||
setTargetVideoBitrate | Specifies the target video bitrate. Valid values: [100,5000]. Unit: Kbit/s. | ||||||
setMinVideoBitrate | Specifies the minimum video bitrate. Valid values: [100,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 retouching. | ||||||
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 orientation. By default, streams are ingested in portrait mode. | ||||||
setAudioEffectVoiceChangeMode | Sets the voice change mode. | ||||||
setAudioEffectReverbMode | Sets the reverberation mode. | ||||||
startBGMAsync | Plays 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 initial position are ([0,width),[0,height)). The value range of the width is (0,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 rotation angle for the screen 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) on the stream ingest side. | ||||||
setLiveMixTranscodingConfig | Sets the parameters for cloud-based stream mixing (transcoding). | ||||||
getLiveTraceId | Queries the trace ID. |
AlivcLivePlayer - provides methods related to stream pulling
This class is available only for stream pulling in interactive mode.
Method | 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 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 engine. | ||||||
getMode | Queries the current stream pulling mode. |
Classes for listeners
AlivcLiveBaseListener
Callback | Description | ||||||
onLicenseCheck | The asynchronous callback for the authentication results of SDK licenses. |
AlivcLivePushErrorListener
Callback | Description | ||||||
onSDKError | The callback for SDK errors. | ||||||
onSystemError | The callback for system errors. |
AlivcLivePushNetworkListener
Callback | Description | ||||||
onConnectFail | Indicates that the connection fails. | ||||||
onConnectionLost | Indicates that the connection is interrupted. | ||||||
onNetworkPoor | Indicates that the network condition is poor. | ||||||
onNetworkRecovery | Indicates that the network recovers. | ||||||
onPacketsLost | The callback for packet loss during stream ingest. | ||||||
onPushURLAuthenticationOverdue | Indicates that authentication expires. | ||||||
onReconnectFail | Indicates that the reconnection fails. | ||||||
onReconnectStart | Indicates that the reconnection starts. | ||||||
onReconnectSucceed | Indicates that the reconnection is successful. | ||||||
onSendDataTimeout | Indicates that the data transmission times out. | ||||||
onSendMessage | Indicates that SEI is sent. |
AlivcLivePushInfoListener
Callback | Description | ||||||
onAdjustBitrate | Indicates that the bitrate is adjusted. | ||||||
onAdjustFps | Indicates that the frame rate is adjusted. | ||||||
onDropFrame | Indicates that frames drop. | ||||||
onFirstAVFramePushed | Indicates that the first audio and video packet is sent. | ||||||
onFirstFramePreviewed | Indicates that the first frame is rendered. | ||||||
onPreviewStarted | Indicates that the preview starts. | ||||||
onPreviewStopped | Indicates that the preview ends. | ||||||
onPushPaused | Indicates that the stream ingest is paused. | ||||||
onPushRestarted | Indicates that the stream ingest restarts. | ||||||
onPushResumed | Indicates that the stream ingest is resumed. | ||||||
onPushStarted | Indicates that the stream ingest starts. | ||||||
onPushStatistics | The callback for data statistics on stream ingest. This callback is returned every 2 seconds. | ||||||
onPushStopped | Indicates that the stream ingest ends. | ||||||
onSetLiveMixTranscodingConfig | The callback for configuration of the cloud-based stream mixing (transcoding) parameters. |
AlivcLivePushBGMListener
Callback | Description | ||||||
onCompleted | Indicates that the playback ends. | ||||||
onDownloadTimeout | Indicates that the player times out. The player is reconnected and seeks the previous playback position. | ||||||
onOpenFailed | Indicates that the stream is invalid and inaccessible. | ||||||
onPaused | Indicates that the playback is paused. | ||||||
onProgress | Indicates the playback progress. | ||||||
onResumed | Indicates that the playback is resumed. | ||||||
onStarted | Indicates that the playback starts. | ||||||
onStopped | Indicates that the playback stops. |
AlivcLivePlayInfoListener
Callback | Description | ||||||
onError | The callback for errors. | ||||||
onFirstVideoFrameDrawn | The callback for playback of the video. | ||||||
onPlayStarted | The callback for playback start. | ||||||
onPlayStopped | The callback for playback stop. |