All Products
Search
Document Center

ApsaraVideo Live:Methods

Last Updated:Feb 01, 2024

This topic describes the methods that are provided by Push SDK for Flutter.

Background information

For more information about the methods, see LIBRARIES.

Basic classes

Class

Dart file

Description

AlivcBase

live_base.dart

The basic class for stream ingest.

AlivcLivePusherConfig

live_push_config.dart

The class for stream ingest configurations.

AlivcLivePusher

live_pusher.dart

The class used to configure the stream ingest engine.

AlivcPusherPreview

live_pusher_preview.dart

The class used to control the preview view.

-

live_push_def.dart

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

Sets the listener for callbacks.

setLogLevel

Sets the log level.

setConsoleEnable

Specifies whether to enable log printing in the console.

setLogPath

Sets 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

Sets 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

Sets a bitrate control mode.

getQualityMode

Queries the bitrate control mode.

setTargetVideoBitrate

Sets the target bitrate of the video.

getTargetVideoBitrate

Queries the target bitrate of the video.

setMinVideoBitrate

Sets the minimum bitrate of the video.

getMinVideoBitrate

Queries the minimum bitrate of the video.

setInitialVideoBitrate

Sets the initial bitrate of the video.

getInitialVideoBitrate

Queries the initial bitrate of the video.

setAudioBitrate

Sets the audio bitrate.

getAudioBitrate

Queries the audio bitrate.

setAudioSampleRate

Sets the audio sampling rate.

getAudioSampleRate

Queries the audio sampling rate.

setFps

Sets the frame rate.

getFps

Queries the frame rate.

setMinFps

Sets the minimum frame rate.

getMinFps

Queries the minimum frame rate.

setVideoEncodeGop

Sets the group of pictures (GOP) size.

getVideoEncodeGop

Queries the GOP size.

setAudioEncoderProfile

Sets the audio encoding format.

getAudioEncoderProfile

Queries the audio encoding format.

setAudioChannel

Sets the number of audio channels.

getAudioChannel

Queries the number of audio 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

Sets the audio encoding mode.

getAudioEncoderMode

Queries the audio encoding mode.

setVideoEncoderMode

Sets the video encoding mode.

getVideoEncoderMode

Queries the video encoding mode.

setVideoHardEncoderCodec

Sets the video codec for hardware encoding.

getVideoHardEncoderCodec

Queries the video codec for hardware encoding.

setOpenBFrame

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

getOpenBFrame

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

setOrientation

Sets the orientation for stream ingest.

getOrientation

Queries the orientation for stream ingest.

setPreviewDisplayMode

Sets the preview mode.

getPreviewDisplayMode

Queries the preview mode.

setConnectRetryInterval

Sets the reconnection interval.

getConnectRetryInterval

Queries the reconnection interval.

setConnectRetryCount

Sets 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

Sets 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

Sets external custom audio data.

getExternAudioFormat

Queries external custom audio data.

setExternVideoFormat

Sets external custom video data.

getExternVideoFormat

Queries external custom video data.

setAudioScene

Sets 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

Create a Config object to associate AlivcLivePusherConfig with AlivcLivePusher.

initLivePusher

Creates a stream ingest engine.

setErrorDelegate

Configures the callback for stream ingest errors.

setInfoDelegate

Configures the callback for the stream ingest status.

setNetworkDelegate

Configures the callback for the network status during stream ingest.

setBGMDelegate

Configures the callback 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 ingesting the stream.

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 when AlivcLivePusherConfig is not used on iOS.

setAutoFocus

Specifies whether to enable autofocus.

focusCameraAtAdjustedPoint

Configures focus.

setZoom

Configures 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

Sets 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

Sets the stream ingest mode.

setTargetVideoBitrate

Sets the target bitrate.

setMinVideoBitrate

Sets the minimum bitrate.

setPreviewDisplayMode

Sets the preview mode.

setResolution

Sets 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

Sets the voice change mode.

setAudioEffectReverbMode

Sets the reverberation mode.

setBGMVolume

Sets the volume of music in mixed audio.

setCaptureVolume

Sets the volume of vocal in mixed audio.

sendMessage

Sets 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

Configures snapshot settings.

setSnapshotDelegate

Configures the callback for snapshot capture. You can call this method only after you call snapshot.

sendVideoData

Sends custom video data.

sendPCMData

Sends custom audio data.

setOnSDKError

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

setOnSystemError

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

setOnPreviewStarted

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

setOnPreviewStoped

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

setOnFirstFramePreviewed

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

setOnPushStarted

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

setOnPushPaused

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

setOnPushResumed

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

setOnPushRestart

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

setOnPushStoped

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

setOnConnectFail

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

setOnConnectRecovery

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

setOnConnectionLost

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

setOnNetworkPoor

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

setOnReconnectError

Configures the callback for failed reconnections. The callback is returned by setNetworkDelegate.

setOnReconnectStart

Configures the callback for reconnection attempts. The callback is returned by setNetworkDelegate.

setOnReconnectSuccess

Configures the callback for successful reconnections. The callback is returned by setNetworkDelegate callback.

setOnSendDataTimeout

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

setOnSendSeiMessage

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

setOnBGMCompleted

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

setOnBGMDownloadTimeout

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

setOnBGMOpenFailed

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

setOnBGMPaused

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

setOnBGMProgress

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

setOnBGMResumed

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

setOnBGMStarted

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

setOnBGMStoped

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

setOnSnapshot

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