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

For more information about the classes and methods, see LIBRARIES.

Basic classes

Class

Dart file

Description

AlivcBase

live_base.dart

The base class for stream ingest.

AlivcLivePusherConfig

live_push_config.dart

The class that is used to configure stream ingest.

AlivcLivePusher

live_pusher.dart

The class that is used to configure a stream ingest engine.

AlivcPusherPreview

live_pusher_preview.dart

The class that is used to control the preview view.

-

live_push_def.dart

The class that is used to define stream ingest parameters.

Basic stream ingest methods

AlivcBase

Method

Description

init

Creates an AlivcBase instance.

getSdkVersion

Obtains the version number of the SDK.

setObserver

Specifies the listener for callbacks.

setLogLevel

Specifies the log level.

setConsoleEnable

Specifies whether to enable logging for the console.

setLogPath

Specifies the log path.

registerSDK

Registers the SDK.

setOnLicenceCheck

Configures the callback for license verification. The callback is returned by setObserver.

Stream ingest configuration methods

AlivcLivePusherConfig

Method

Description

init

Creates an AlivcLivePusherConfig instance.

setResolution

Specifies the resolution.

getResolution

Queries the resolution.

setEnableAutoBitrate

Specifies whether to enable adaptive bitrate streaming.

getEnableAutoBitrate

Queries whether adaptive bitrate streaming is enabled.

setEnableAutoResolution

Specifies whether to enable adaptive resolution.

getEnableAutoResolution

Queries whether adaptive resolution is enabled.

setQualityMode

Specifies the bitrate control mode.

getQualityMode

Queries the bitrate control mode.

setTargetVideoBitrate

Specifies the expected bitrate of the video.

getTargetVideoBitrate

Queries the expected bitrate of the video.

setMinVideoBitrate

Specifies the minimum bitrate of the video.

getMinVideoBitrate

Queries the minimum bitrate of the video.

setInitialVideoBitrate

Specifies the initial bitrate of the video.

getInitialVideoBitrate

Queries the initial bitrate of the video.

setAudioBitrate

Specifies the audio bitrate.

getAudioBitrate

Queries the audio bitrate.

setAudioSampleRate

Specifies the audio sampling rate.

getAudioSampleRate

Queries the audio sampling rate.

setFps

Specifies the frame rate.

getFps

Queries the frame rate.

setMinFps

Specifies the minimum frame rate.

getMinFps

Queries the minimum frame rate.

setVideoEncodeGop

Specifies the group of pictures (GOP) size.

getVideoEncodeGop

Queries the GOP size.

setAudioEncoderProfile

Specifies the audio encoding format.

getAudioEncoderProfile

Queries the audio encoding format.

setAudioChannel

Specifies the number of sound channels.

getAudioChannel

Queries the number of sound channels.

setAudioOnly

Specifies whether the ingested stream is an audio-only stream.

getAudioOnly

Queries whether the ingested stream is an audio-only stream.

setVideoOnly

Specifies whether the ingested stream is a video-only stream.

getVideoOnly

Queries whether the ingested stream is a video-only stream.

setAudioEncoderMode

Specifies the audio encoding mode.

getAudioEncoderMode

Queries the audio encoding mode.

setVideoEncoderMode

Specifies the video encoding mode.

getVideoEncoderMode

Queries the video encoding mode.

setVideoHardEncoderCodec

Specifies the encoding format for hardware encoding.

getVideoHardEncoderCodec

Queries the encoding format for hardware encoding.

setOpenBFrame

Specifies whether to enable B-frames in hardware encoding mode.

getOpenBFrame

Queries whether B-frames are enabled in hardware encoding mode.

setOrientation

Specifies the orientation for stream ingest.

getOrientation

Queries the orientation for stream ingest.

setPreviewDisplayMode

Specifies the preview mode.

getPreviewDisplayMode

Queries the preview mode.

setConnectRetryInterval

Specifies the reconnection interval.

getConnectRetryInterval

Queries the reconnection interval.

setConnectRetryCount

Specifies the number of reconnection attempts.

getConnectRetryCount

Queries the number of reconnection attempts.

setPushMirror

Specifies whether to enable the mirroring mode for stream ingest.

getPushMirror

Queries whether the mirroring mode is enabled for stream ingest.

setPreviewMirror

Specifies whether to enable the mirroring mode for preview.

getPreviewMirror

Queries whether the mirroring mode is enabled for preview.

setCameraType

Specifies the camera type.

getCameraType

Queries the camera type.

setAutoFocus

Specifies whether to enable autofocus.

getAutoFocus

Queries whether autofocus is enabled.

setPauseImg

Specifies the image that is displayed if stream ingest is paused.

setNetworkPoorImg

Specifies the image that is displayed in case of a low bitrate.

setExternAudioFormat

Specifies external custom audio data.

getExternAudioFormat

Queries external custom audio data.

setExternVideoFormat

Specifies external custom video data.

getExternVideoFormat

Queries external custom video data.

setAudioScene

Specifies the audio scenario.

getAudioScene

Queries the audio scenario.

setExternMainStream

Specifies whether to use external custom data for stream ingest.

getExternMainStream

Queries whether external custom data is used for stream ingest.

Stream ingest engine configuration methods

AlivcLivePusher

Method

Description

init

Creates an AlivcLivePusher instance.

createConfig

Creates a Config object to associate AlivcLivePusherConfig with AlivcLivePusher.

initLivePusher

Creates a stream ingest engine.

setErrorDelegate

Specifies the listener for stream ingest errors.

setInfoDelegate

Specifies the listener for the stream ingest status.

setNetworkDelegate

Specifies the listener for the network status during stream ingest.

setBGMDelegate

Specifies the listener for background music.

startPreview

Starts preview. This is a synchronous method.

startPreviewAsync

Starts preview. This is an asynchronous method.

startPushWithURL

Starts stream ingest. This is a synchronous method.

startPushWithURLAsync

Starts stream ingest. This is an asynchronous method.

stopPreview

Stops preview.

stopPush

Stops stream ingest.

restartPush

Restarts stream ingest. This is a synchronous method.

restartPushAsync

Restarts stream ingest. This is an asynchronous method.

pause

Pauses stream ingest from the camera.

resume

Resumes stream ingest from the camera.

resumeAsync

Resumes stream ingest. This is an asynchronous method.

switchCamera

Switches between the front and rear cameras.

reconnectPushAsync

Reconnects. This is an asynchronous method.

reconnectPushAsyncWithPushURL

Reconnects the ingest URL. This is an asynchronous method.

destroy

Destroys the stream ingest engine.

destroyConfigForIOS

Resets the Config object on iOS. You can use this method to clear the settings that are configured by the Config object if you no longer need to use AlivcLivePusherConfig on iOS.

setAutoFocus

Specifies whether to enable autofocus.

focusCameraAtAdjustedPoint

Configures the settings of focus.

setZoom

Configures the settings of zoom.

getMaxZoom

Queries the maximum zoom value that is supported.

getCurrentZoom

Queries the current zoom value.

setFlash

Specifies whether to turn on the flash.

setExposure

Specifies the exposure level.

getCurrentExposure

Queries the current exposure level.

getSupportedMinExposure

Queries the minimum exposure level that is supported.

getSupportedMaxExposure

Queries the maximum exposure level that is supported.

setPushMirror

Specifies whether to enable the mirroring mode for stream ingest.

setPreviewMirror

Specifies whether to enable the mirroring mode for preview.

setMute

Mutes the ingested stream.

setQualityMode

Specifies the stream ingest mode.

setTargetVideoBitrate

Specifies the expected bitrate.

setMinVideoBitrate

Specifies the minimum bitrate.

setPreviewDisplayMode

Specifies the preview mode.

setResolution

Specifies the resolution of the ingested stream. This method takes effect only in preview mode and cannot be called during stream ingest.

startBGMWithMusicPathAsync

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

setAudioDenoise

Specifies whether to enable noise reduction.

setAudioEffectVoiceChangeMode

Specifies the voice change mode.

setAudioEffectReverbMode

Specifies the reverberation mode.

setBGMVolume

Specifies the volume of background music in mixed audio.

setCaptureVolume

Specifies the volume of vocal in mixed audio.

sendMessage

Specifies a custom supplemental enhancement information (SEI) message.

isPushing

Queries whether the stream is being ingested.

getPushURL

Queries the ingest URL.

getLiveStatus

Queries the stream ingest status.

addWatermark

Adds watermarks.

setWatermarkVisible

Specifies whether to show or hide watermarks.

addDynamicWaterMarkImageData

Adds an animated sticker.

removeDynamicWaterMark

Removes an animated sticker.

snapshot

Specifies the settings of snapshot.

setSnapshotDelegate

Specifies the listener for snapshot capture. You can call this method only after you call the snapshot method.

sendVideoData

Sends custom video data.

sendPCMData

Sends custom audio data.

setOnSDKError

Specifies the callback for SDK errors. The callback is returned by setErrorDelegate.

setOnSystemError

Specifies the callback for system errors. The callback is returned by setErrorDelegate.

setOnPreviewStarted

Specifies the callback for preview start. The callback is returned by setInfoDelegate.

setOnPreviewStoped

Specifies the callback for preview stop. The callback is returned by setInfoDelegate.

setOnFirstFramePreviewed

Specifies the callback for first frame rendering. The callback is returned by setInfoDelegate.

setOnPushStarted

Specifies the callback for start of stream ingest. The callback is returned by setInfoDelegate.

setOnPushPaused

Specifies the callback for pause of stream ingest from the camera. The callback is returned by setInfoDelegate.

setOnPushResumed

Specifies the callback for resume of stream ingest from the camera. The callback is returned by setInfoDelegate.

setOnPushRestart

Specifies the callback for restart of stream ingest. The callback is returned by setInfoDelegate.

setOnPushStoped

Specifies the callback for end of stream ingest. The callback is returned by setInfoDelegate.

setOnConnectFail

Specifies the callback for failed stream ingest. The callback is returned by setNetworkDelegate.

setOnConnectRecovery

Specifies the callback for network recovery. The callback is returned by setNetworkDelegate.

setOnConnectionLost

Specifies the callback for disconnected stream ingest. The callback is returned by setNetworkDelegate.

setOnNetworkPoor

Specifies the callback for poor network conditions. The callback is returned by setNetworkDelegate.

setOnReconnectError

Specifies the callback for failed reconnection. The callback is returned by setNetworkDelegate.

setOnReconnectStart

Specifies the callback for reconnection attempt. The callback is returned by setNetworkDelegate.

setOnReconnectSuccess

Specifies the callback for successful reconnection. The callback is returned by setNetworkDelegate callback.

setOnSendDataTimeout

Specifies the callback for data transmission timeout. The callback is returned by setNetworkDelegate.

setOnSendSeiMessage

Specifies the callback for prompt to send an SEI message. The callback is returned by setNetworkDelegate.

setOnBGMCompleted

Specifies the callback for complete playback of background music. The callback is returned by setBGMDelegate.

setOnBGMDownloadTimeout

Specifies the callback for timeout of background music download. The callback is returned by setBGMDelegate.

setOnBGMOpenFailed

Specifies the callback for failed playback of background music. The callback is returned by setBGMDelegate.

setOnBGMPaused

Specifies the callback for paused playback of background music. The callback is returned by setBGMDelegate.

setOnBGMProgress

Specifies the callback for playback progress. The callback is returned by setBGMDelegate.

setOnBGMResumed

Specifies the callback for resumed playback of background music. The callback is returned by setBGMDelegate.

setOnBGMStarted

Specifies the callback for start of background music playback. The callback is returned by setBGMDelegate.

setOnBGMStoped

Specifies the callback for stop of background music playback. The callback is returned by setBGMDelegate.

setOnSnapshot

Specifies the callback for snapshot capture. The callback is returned by setSnapshotDelegate.