AliRtcEngine interface

更新时间:
复制 MD 格式

This topic describes the AliRtcEngine interface of the Windows SDK.

Table of contents

Basic methods

API

Description

Supported in the above version

setH5CompatibleMode

Set the H5 compatibility mode.

1.1

getH5CompatibleMode

Check whether H5 is currently compatible.

1.1

sharedInstance

Create an AliRtcEngine instance (only one instance exists at the same time).

1.1

destroy

SDK resources are released.

1.1

uploadLog

Upload logs.

1.15

setLogDirPath

Sets the path for storing the log files of AliLive SDK.

1.16.2

Channel-related interfaces

API

Description

Supported in the above version

setAutoPublishSubscribe

Specify whether to automatically publish and subscribe.

1.1

joinChannel

Join the channel.

1.1

leaveChannel

Off the channel.

1.1

isInCall

Check whether you are currently in the channel.

1.1

setChannelProfile

Set the channel mode.

1.15

Publish related interfaces

API

Description

Supported in the above version

isAutoPublish

You can call this operation to query whether the automatic publishing mode is current.

1.1

configLocalCameraPublish

Specify whether to allow the camera stream to be published.

1.1

isLocalCameraPublishEnabled

Queries whether the camera stream is currently allowed to be published.

1.1

configLocalScreenPublish

Specify whether to allow publishing screen streams.

1.1

isLocalScreenPublishEnabled

Queries whether the current screen stream is allowed to be published.

1.1

configLocalAudioPublish

Specify whether to allow the audio stream to be published.

1.1

isLocalAudioPublishEnabled

Queries whether audio streams are currently allowed.

1.1

configLocalSimulcast

Specify whether to allow secondary video streams to be published.

1.1

isLocalSimulcastEnabled

Queries whether secondary video streams are currently allowed to be published.

1.1

publish

Manually publish video and audio streams.

1.1

Subscription-related interfaces

API

Description

Supported in the above version

isAutoSubscribe

Query whether the current subscription mode is automatic.

1.1

configRemoteCameraTrack

Specifies whether to subscribe to the remote camera stream.

1.1

configRemoteScreenTrack

Specifies whether to subscribe to a remote screen stream.

1.1

configRemoteAudio

Specifies whether to subscribe to remote audio streams.

1.1

subscribe

Manually subscribe to video and audio streams.

1.1

subscribeAudioData

Subscribe to audio data.

1.16.2

unsubscribeAudioData

Unsubscribe from audio data.

1.16.2

Video-related methods

API

Description

Supported in the above version

setVideoProfile

Set parameters for the video stream.

1.1

setLocalViewConfig

Set the rendering window and drawing parameters for local preview.

1.1

muteLocalCamera

Specify whether to stop publishing local video streams.

1.1

setRemoteViewConfig

Set the rendering window and drawing parameters for the remote video.

1.1

getCameraList

Gets the list of cameras.

1.1

getCurrentCamera

Gets the name of the camera currently in use.

1.1

setCurrentCamera

Select a camera.

1.1

isCameraOn

Check whether the camera is turned on.

1.1

getScreenShareSourceInfo

Gets the screen sharing source information.

1.15

getDesktopResolution

Get the screen sharing desktop resolution.

1.15

setScreenShareSource

Specify the screen sharing source.

1.15

getScreenShareSource

Gets the screen sharing source.

1.15

getCurrentCameraId

Gets the ID of the currently used camera.

1.16.2

setCurrentCameraById

Select a camera by device ID.

1.16.2

setExternalVideoSource

Enable an external video input source.

1.16.2

pushExternalVideoFrame

Enter an external video.

1.16.2

registerVideoSampleObserver

Subscribe to video data output.

1.16.2

unRegisterVideoSampleObserver

Unsubscribe video data output.

1.16.2

stopRecord

Stop recording.

1.17

startRecord

Start recording.

1.17

setBeatutyEffect

Set Basic Beauty.

1.17.9

setVideoEncoderConfiguration

Set video encoding properties.

1.17.31

setScreenShareSourceByRegion

Share the source by specifying the locale screen.

1.17.38

Audio-related methods

API

Description

Supported in the above version

setAudioOnlyMode

Set whether to audio-only mode or audio-video mode.

1.1

isAudioOnly

Query whether the current audio-only mode is displayed.

1.1

muteLocalMic

Specify whether to stop publishing local audio.

1.1

muteRemoteAudioPlaying

Specifies whether to stop playing remote audio streams.

1.1

getAudioCaptures

Obtains the list of recording devices in the system.

1.1

getCurrentAudioCapture

Gets the currently used audio collection device name.

1.1

setCurrentAudioCapture

Select an audio acquisition device.

1.1

getAudioRenderers

Gets the list of speakers in the system.

1.1

getCurrentAudioRenderer

Gets the audio playback device currently in use.

1.1

setCurrentAudioRenderer

Select an audio playback device.

1.1

startAudioCapture

Enable audio collection.

1.11

stopAudioCapture

Disable audio collection.

1.11

startAudioPlayer

Turn on the audio playback device.

1.11

stopAudioPlayer

Disables audio playback.

1.11

muteAllRemoteAudioPlaying

Stop the playback of all audio streams at the far end.

1.16.2

getCurrentAudioCaptureId

Gets the ID of the recording device used.

1.16.2

setCurrentAudioCaptureById

Select a recording device by device ID.

1.16.2

getCurrentAudioRendererId

Gets the ID of the speaker currently in use.

1.16.2

setCurrentAudioRendererById

Select the speaker by device ID.

1.16.2

setRecordingVolume

Sets the recording volume.

1.16.2

setPlayoutVolume

Sets the playback volume.

1.16.2

setSubscribeAudioNumChannel

Specifies the number of output audio channels.

1.16.2

setSubscribeAudioSampleRate

Specifies the output audio sample rate.

1.16.2

setExternalAudioSource

Specifies whether to use external audio data as the input source for streaming.

1.16.2

pushExternalAudioFrameRawData

Input audio data.

1.16.2

setMixedWithMic

Specifies whether the external audio input is mixed with the microphone to collect audio.

1.16.2

setExternalAudioPublishVolume

Set the external audio input volume.

1.16.2

getExternalAudioPublishVolume

Gets the external audio input volume.

1.17

setExteranlAudioRender

Specifies whether to enable external input audio playback.

1.16.2

pushExternalAudioRenderRawData

Input audio playback data.

1.16.2

setExternalAudioPlayoutVolume

Set the external audio playback volume.

1.16.2

getExternalAudioPlayoutVolume

Gets the audio playback volume.

1.16.2

setAudioEffectReverbMode

Set the reverb sound mode.

1.17

setAudioEffectReverbParamType

Specifies the reverb sound effect type.

1.17

setVolumeCallbackIntervalMs

Set the volume callback frequency and smoothing factor.

1.17.9

setRecordingDeviceVolume

Set the audio collection device volume.

1.17.30

getRecordingDeviceVolume

Obtains the audio collection device volume.

1.17.30

setPlaybackDeviceVolume

Set the audio playback device volume.

1.17.30

getPlaybackDeviceVolume

Gets the audio playback device volume.

1.17.30

Preview Port

API

Description

Supported in the above version

startPreview

Start local preview.

1.1

stopPreview

Stop local preview.

1.1

Remote user query interface

API

Description

Supported in the above version

getOnlineRemoteUsers

Obtains the list of remote online users.

1.1

getUserInfo

Queries remote user information.

1.1

isUserOnline

Queries whether a user is online.

1.1

Other operations

API

Description

Supported in the above version

setLogLevel

Configures the log level.

1.1

getSdkVersion

Obtain the SDK version number.

1.1

setClientRole

Specify a user role.

1.16

startLastmileDetect

Start network quality detection.

1.16.2

stopLastmileDetect

Stop network quality detection.

1.16.2

postFeedback

SDK problem feedback.

1.17.12

sendMediaExtensionMsg

Send media extension information.

1.17.1

getClientRole

Gets the user role.

1.17.19

startIntelligentDenoise

Enable intelligent noise reduction.

1.17.19

stopIntelligentDenoise

Turn off intelligent noise reduction.

1.17.19

RefreshAuthInfo

Refresh the token.

1.17.41

API operation details

  • setH5CompatibleMode: specifies whether to enable H5 compatibility.

    static void setH5CompatibleMode(bool comp)         

    Parameter description

    Parameter

    Type

    Description

    comp

    bool

    true indicates that it is compatible with H5. false indicates that it is not compatible with H5. Incompatible with H5 by default.

    Important

    The current version does not support changing the H5 compatibility mode after the AliRtcEngine instance is created. You must call this method before the instance is created.

  • getH5CompatibleMode: checks whether the system is compatible with H5.

    static bool getH5CompatibleMode()               

    Return result

    true indicates that it is compatible with H5. false indicates that it is not compatible with H5.

  • sharedInstance: creates an AliRTCEngine instance.

    static AliRtcEngine* sharedInstance(AliRtcEventListener* listener, const AliRtc::String &extras)         

    Parameter description

    Parameter

    Type

    Description

    listener

    AliRtcEventListener*

    The listener for the AliRtcEngine callback.

    extras

    const AliRtc::String &

    For more information about the special features of the SDK, see Extras.

    Important

    Only one instance will exist at the same time.

  • destroy: The SDK resources are released.

    static AliRtcEngine::destroy();
    Important

    Called after all operations have ended.

  • uploadLog: uploads logs. By default, the file is automatically uploaded.

    static void uploadLog();
  • setLogDirPath: specifies the path where the SDK log files are saved.

    static int setLogDirPath(const AliRtc::String &logDirPath)

    Parameter description

    Parameter

    Type

    Description

    logDirPath

    const AliRtc::String &

    The absolute path where the log file is saved. Default path:%appdata % directory.

    Return result

    0 indicates that the method call was successful. Non -0 indicates that the method call failed.

    Important

    To call this operation, you must set this parameter before calling all SDK operations to avoid log loss. At the same time, the App must ensure that the specified directory already exists and can be written to.

  • setAutoPublishSubscribe: specifies whether to automatically publish and whether to automatically subscribe.

    int setAutoPublishSubscribe(bool autoPub, bool autoSub)

    Parameter description

    Parameter

    Type

    Description

    autoPub

    bool

    true indicates automatic publishing. false indicates manual publishing. Default value: true.

    autoSub

    bool

    true indicates automatic subscription. false indicates manual subscription. Default value: true.

    Return result

    0 indicates that the method call was successful. Others indicate that the method call failed.

    Important

    This interface must be called before joining the channel.

  • joinChannel: joins a channel.

    void joinChannel(const AliRtcAuthInfo& authInfo, const AliRtc::String& userName, void(*)(void* opaquePtr, int errCode) onResult, void* opaquePtr)                  

    After you join a channel, you must call the leaveChannel operation to leave the channel. If you fail to join a channel, you do not need to call the leaveChannel operation.

    Parameter description

    Parameter

    Type

    Description

    authInfo

    const AliRtcAuthInfo&

    The authentication information.

    userName

    const AliRtc::String&

    The display name of the user (not the user ID).

    onResult

    void()(void opaquePtr, int errCode)

    Callback after the execution of the added channel ends.

    opaquePtr

    void*

    The UserData provided by the app is returned to the app when onResult is called.

    Important

    This interface is an asynchronous interface, and it is judged by onResult that the lambda expression is converted to onResult.

    void (*foo)(void*, int);
    foo = [](void* opaquePtr, int errCode) {
    ClassA *pThis = (ClassA *)opaquePtr;
    if(errCode != 0) {
    pThis->OutputError("Failed to exeucte joinChannel.");
    }
    };
    mpEngine->joinChannel(/*authInfo*/, /*userName*/, foo, /*opaquePtr*/)
  • leaveChannel: leaves the channel.

    void leaveChannel()

    1.15 or later: Destroy the engine only by using the destroy method.

    1.15 the following version: When you leave a channel, the AliRtcEngine instance is destroyed. To continue operations such as adding a channel, you need to call getInstance again to initialize the AliRtcEngine instance.

    Important

    If you are not in a channel, calling the leaveChannel operation does not affect the instance. However, a message is generated to notify other users in the channel.

  • isInCall: checks whether it is currently in the channel.

    bool isInCall()                

    Return result

    true indicates that it is in the channel. false indicates that it is not in the channel.

  • setChannelProfile: Set the channel mode.

    int setChannelProfile(const AliRtcChannelProfile channelProfile)

    Parameter description

    Parameter

    Type

    Description

    channelProfile

    AliRtcChannelProfile

    The type of the channel. The default value is AliRtcCommunication.

    Return result

    0 indicates that the method call was successful. Others indicate that the method call failed.

    Important

    This interface can only be called before joining the channel. It cannot be reset during meetings. It can be reset after leaving the channel.

  • isAutoPublish: queries whether the automatic publishing mode is displayed.

    bool isAutoPublish()                

    Return result

    true indicates automatic publishing. false indicates manual publishing.

  • configLocalCameraPublish: specifies whether to allow the camera stream to be published.

    void configLocalCameraPublish(bool enable)               

    Parameter description

    Parameter

    Type

    Description

    enable

    bool

    true indicates that the camera stream is allowed to be published. false indicates that the camera stream is not allowed to be published. Default value: true.

    Important

    When you manually call this operation, you must call publish to take effect.

  • isLocalCameraPublishEnabled: queries whether the camera stream is currently allowed to be published.

    public abstract boolean isLocalCameraPublishEnabled()                   

    Return result

    true indicates that the camera stream is allowed to be published. false indicates that the camera stream is not allowed to be published.

  • configLocalScreenPublish: specifies whether to allow the release of screen streams.

    void configLocalScreenPublish(bool enable)                

    Parameter description

    Parameter

    Type

    Description

    enable

    bool

    true indicates that the screen stream is allowed to be published. false indicates that the screen stream is not allowed to be published. Default value: false.

    Important

    When you manually call this operation, you must call publish to take effect.

  • isLocalScreenPublishEnabled: queries whether the screen stream is currently allowed to be published.

    bool isLocalScreenPublishEnabled()                

    Return result

    true indicates that the screen stream is allowed to be published. false indicates that the screen stream is not allowed to be published.

  • configLocalAudioPublish: specifies whether to allow audio streams to be published.

    void configLocalAudioPublish(bool enable)        

    Parameter description

    Parameter

    Type

    Description

    enable

    bool

    true indicates that the audio stream is allowed to be published. false indicates that the audio stream is not allowed to be published. Default value: true.

    Important

    When you manually call this operation, you must call publish to take effect.

  • isLocalAudioPublishEnabled: queries whether the current audio stream is allowed to be published.

    bool isLocalAudioPublishEnabled()               

    Return result

    true indicates that the audio stream is allowed to be published. false indicates that the audio stream is not allowed to be published.

  • configLocalSimulcast: specifies whether to allow secondary video streams to be published.

    int AliRtcEngine::configLocalSimulcast(bool enabled, AliRtcVideoTrack track)     

    Parameter description

    Parameter

    Type

    Description

    enable

    bool

    true indicates that secondary video streams are allowed to be published. false indicates that secondary video streams are not allowed to be published. Default value: true.

    track

    AliRtcVideoTrack

    The type of the stream. Currently, only AliVideoTrackCamera (camera stream) is supported.

    Important

    When you manually call this operation, you must call publish to take effect.

  • isLocalSimulcastEnabled: queries whether secondary video streams are allowed to be published.

    bool isLocalSimulcastEnabled()               

    Return result

    true indicates that secondary video streams are allowed to be published. false indicates that secondary video streams are not allowed to be published.

publish: Manually publish video and audio streams.

void publish(void(*)(void* opaquePtr, int errCode) onResult, void* opaquePtr)             
  • The actual performance of the call publish must be determined by combining the configLocalCameraPublish, configLocalScreenPublish, configLocalAudioPublish, and configLocalSimulcast interfaces.

  • Configure the parameters of the preceding four interfaces based on your specific business requirements to publish the corresponding video and audio streams.

Parameter description

Parameter

Type

Description

onResult

void()(void opaquePtr, int errCode)

Call the callback after the publish execution is completed.

opaquePtr

void*

The UserData provided by the app is returned to the app when onResult is called.

Important

This interface is an asynchronous interface that uses onResult to determine the result of the call, and the lambda expression is converted to onResult.

void (*foo)(void *, int);
foo = [](void*opaquePtr,  int errCode) {
ClassA *pThis = (ClassA *)opaquePtr;
pThis->OutputError("publish result: %d", errCode);
};
publish(foo, /*UserData*/);
  • isAutoSubscribe: queries whether the subscription mode is automatic.

    bool isAutoSubscribe()                

    Return result

    true indicates automatic subscription. false indicates manual subscription.

  • configRemoteCameraTrack: specifies whether to subscribe to remote camera streams.

    void configRemoteCameraTrack(const AliRtc::String& uid, bool preferMaster, bool enable)               

    Parameter description

    Parameter

    Type

    Description

    uid

    String

    The ID of the user.

    preferMaster

    bool

    true indicates that you subscribe to a large stream. false indicates that you subscribe to a small stream. Default value: true.

    enable

    bool

    true indicates that the remote camera stream is subscribed to. false indicates that the remote camera stream is stopped. No subscription by default.

    Important

    This interface is called to disable subscription when the stream is performed, for example, manual subscription. You must call subscribe to take effect.

  • configRemoteScreenTrack: specifies whether to subscribe to the remote screen stream.

    void configRemoteScreenTrack(const AliRtc::String& uid, bool enable)

    Parameter description

    Parameter

    Type

    Description

    uid

    const AliRtc::String&

    The ID of the user.

    enable

    bool

    true indicates that the remote screen stream is subscribed to. false indicates that the remote screen stream is stopped. Default value: false.

    Important

    This interface is called to disable subscription when the stream is performed, for example, manual subscription. You must call subscribe to take effect.

  • configRemoteAudio: specifies whether to subscribe to remote audio streams.

    void configRemoteAudio(const AliRtc::String& uid, bool enable)

    Parameter description

    Parameter

    Type

    Description

    uid

    const AliRtc::String&

    The ID of the user.

    enable

    bool

    true indicates that the remote audio stream is subscribed to. false indicates that the remote audio stream is stopped. Default value: true.

    Important

    This interface is called to disable subscription when the stream is performed, for example, manual subscription. You must call subscribe to take effect.

  • subscribe: manually subscribes to video and audio streams.

    void subscribe(const AliRtc::String& uid, void(*)(void* opaquePtr, const AliRtc::String& uid, AliRtcVideoTrack vt, AliRtcAudioTrack at) onResult, void * opaquePtr)                
    • The actual performance of the call to subscribe must be determined by combining interfaces such as configRemoteCameraTrack, configRemoteScreenTrack, and configRemoteAudio.

    • Configure the parameters of the preceding three interfaces based on your specific business requirements to subscribe to the corresponding video and audio streams.

    • Subscribe and Stop Subscribe are both calls to subscribe.

    • If you want to stop the subscription, set the parameters of the preceding three configuration interfaces to false, and then call the Subscribe operation.

    Parameter description

    Parameter

    Type

    Description

    uid

    const AliRtc::String&

    The ID of the user.

    onResult

    void()(void opaquePtr, const AliRtc::String& uid, AliRtcVideoTrack vt, AliRtcAudioTrack at)

    Call the callback after subscribe is executed.

    opaquePtr

    void *

    The UserData provided by the app is returned to the app when onResult is called.

    Return result

    0 indicates that the interface call is successful, but whether the subscription is successful depends on the callback result. Others indicate that the interface execution is interrupted abnormally and the subscription fails.

    Note

    This interface is an asynchronous interface that uses onResult to determine the result, and the lambda expression is converted to onResult.

    void (foo)(void*, const AliRtc::String&, AliRtcAudioTrack, AliRtcVideoTrack);
    foo = [](void *opaquePtr,const AliRtc::String &uid, AliRtcAudioTrack publishedAudioTrack,AliRtcVideoTrack publishedVideoTrack)
    {
    ClassA *pThis = (ClassA*)opaquePtr;
    OutputError("subscribe result: user: %s,audio: %d, video: %d", uid.asCString(),publishedAudioTrack,publishedVideoTrack);
    };
    publish(foo, this);
  • subscribeAudioData: Subscribe to audio data. By default, audio data is not subscribed.

    virtual void subscribeAudioData(AliRtcAudioSource audioSource)

    Parameter description

    Parameter

    Type

    Description

    audioSource

    AliRtcAudioSource

    The audio data source.

    Important

    Before you call this operation, you must set output audio data parameters by setSubscribeAudioNumChannel and setSubscribeAudioSampleRate.

  • unsubscribeAudioData: unsubscribes from audio data.

    virtual void unsubscribeAudioData(AliRtcAudioSource audioSource)

    Parameter description

    Parameter

    Type

    Description

    audioSource

    AliRtcAudioSource

    The audio data source.

  • setVideoProfile: Set parameters for the video stream.

    void setVideoProfile(AliRtcVideoProfile profile, AliRtcVideoTrack track)                 

    Parameter description

    Parameter

    Type

    Description

    profile

    AliRtcVideoProfile

    The video stream parameters. The default value is AliRtcVideoProfile_Default.

    track

    AliRtcVideoTrack

    The type of the video stream to be specified.

  • setLocalViewConfig: Set the rendering window and drawing parameters for the local preview.

    int setLocalViewConfig(const AliVideoCanvas& canvas, AliRtcVideoTrack track)                  
    • Supports switching windows before and after joining a channel. If hWnd in canvas is NULL, rendering is stopped.

    • If you need to reset the rendering mode during playback, keep other member variables in canvas unchanged and modify only renderMode.

    • The default rendering mode in canvas is AliRtcRenderModeFill.

    Parameter description

    Parameter

    Type

    Description

    canvas

    const AliVideoCanvas&

    Rendering parameters, including the rendering window and rendering mode.

    track

    AliRtcVideoTrack

    The type of video track. Preview allows only AliVideoTrackCamera (camera stream).

  • muteLocalCamera: specifies whether to stop publishing local video streams.

    int muteLocalCamera(bool mute, AliRtcVideoTrack track)              

    Parameter description

    Parameter

    Type

    Description

    mute

    bool

    true indicates that the video stream is stopped. false indicates that the video stream is resumed. Resume publishing by default.

    track

    AliRtcVideoTrack

    The type of the video track that needs to change the publishing status.

    Return result

    0 indicates that the method call was successful. Others indicate that the method call failed.

    Important

    Call this operation without changing the collection status of the current video stream

  • setRemoteViewConfig: Set the rendering window and drawing parameters for the remote video.

    public abstract int setRemoteViewConfig(AliVideoCanvas canvas, String uid, AliRtcVideoTrack track) int setRemoteViewConfig(AliVideoCanvas* canvas, const AliRtc::String& uid, AliRtcVideoTrack track)                   

    Parameter description

    Parameter

    Type

    Description

    canvas

    AliVideoCanvas

    Rendering parameters, including the rendering window and rendering mode.

    uid

    const AliRtc::String&

    The ID of the user.

    track

    AliRtcVideoTrack

    The type of the video track to be set.

  • getCameraList: obtains the list of cameras.

    void getCameraList(AliRtc::StringArray& array)                 

    Parameter description

    Parameter

    Type

    Description

    array

    AliRtc::StringArray&

    The list of cameras.

  • getCurrentCamera: obtains the name of the camera currently in use.

    AliRtc::String getCurrentCamera()                 
  • setCurrentCamera: Select a camera.

    void setCurrentCamera(const AliRtc::String& camera)                    

    Parameter description

    Parameter

    Type

    Description

    camera

    const AliRtc::String&

    The name of the camera.

    Important

    You can call this operation only after you call the getCameraList operation to obtain the device list.

  • isCameraOn: Check whether the camera is turned on.

    bool isCameraOn()                  

    Return result

    true indicates that the camera is turned on. false indicates that the camera is not turned on.

  • getScreenShareSourceInfo: Obtain information about the screen sharing source.

    int getScreenShareSourceInfo(AliRtcScreenShareType source_type, AliRtcScreenSourceList &source_list)

    Parameter description

    Parameter

    Type

    Description

    source_type

    AliRtcScreenShareType

    The type of desktop sharing.

    source_list

    AliRtcScreenSourceList

    Screen sharing data source information.

    Return result

    0 indicates that the method call was successful. Other indicates that the method call failed.

  • getCurrentCameraId: obtains the ID of the currently used camera.

    virtual AliRtc::String getCurrentCameraId()
  • setCurrentCameraById: Select a camera by device ID.

    virtual void setCurrentCameraById(const AliRtc::String &cameraId)

    Parameter description

    Parameter

    Type

    Description

    cameraId

    const AliRtc::String &

    The ID of the camera.

  • setExternalVideoSource: Enable an external video input source.

    virtual int setExternalVideoSource(bool enable, bool useTexture, AliRtcVideoSource sourceType, AliRtcRenderMode renderMode)

    Parameter description

    Parameter

    Type

    Description

    enable

    bool

    true indicates that the external video input source is enabled. false indicates that the external video input source is disabled. By default, external video input sources are disabled.

    useTexture

    bool

    true indicates that the texture mode is used. false indicates that the texture mode is not used.

    sourceType

    AliRtcVideoSource

    The type of the streams to query.

    renderMode

    AliRtcRenderMode

    The rendering mode.

    Return result

    0 indicates that the method call was successful. Other indicates that the method call failed.

    Important

    After this interface is called, you can call the pushExternalVideoFrame interface to input video data.

  • pushExternalVideoFrame: Enter an external video.

    virtual int pushExternalVideoFrame(AliRtcVideoDataSample *frame, AliRtcVideoSource sourceType)

    Parameter description

    Parameter

    Type

    Description

    frame

    AliRtcVideoDataSample *

    Frame data.

    type

    AliRtcVideoSource

    The type of the streams to query.

  • registerVideoSampleObserver: Subscribe to video data output. By default, you do not subscribe to video data output.

    virtual void registerVideoSampleObserver()
    Important

    After this operation is called, the output data is returned through the onCaptureVideoSample and onRemoteVideoSample callback.

  • unRegisterVideoSampleObserver: Unsubscribe from video data output.

    virtual void unRegisterVideoSampleObserver()
  • startRecord: starts recording.

    virtual bool startRecord(AliRtcRecordType recordType, AliRtcRecordFormat recordFormat, const AliRtc::String& filePath, AliRtcRecordAudioConfig& audioConfig, AliRtcRecordVideoConfig& videoConfig, bool isFragment) = 0;

    Parameter description

    Parameter

    Type

    Description

    recordType

    AliRtcRecordType

    The recording format.

    recordFormat

    AliRtcRecordFormat

    The format of the recording.

    filePath

    const AliRtc::String&

    The file path.

    audioConfig

    AliRtcRecordAudioConfig&

    Record audio settings.

    videoConfig

    AliRtcRecordVideoConfig&

    Recording video settings.

    isFragment

    bool

    Indicates whether mp4 internal segmentation is supported. This parameter is valid only when mp4 is recorded.

    Return result

    0 indicates that the method call was successful. Other indicates that the method call failed.

  • setBeatutyEffect: specifies whether to enable basic beautification.

    virtual int setBeatutyEffect(bool enable, AliRtcBeautyConfig config) = 0;

    Parameter description

    Parameter

    Type

    Description

    enable

    bool

    true: enabled. false: disabled. Default value: disabled.

    config

    AliRtcBeautyConfig

    The basic beauty parameters.

    Return result

    0 indicates that the method call was successful. Other indicates that the method call failed.

    Important

    This interface only supports whitening and skin grinding.

  • setVideoEncoderConfiguration: Set video encoding properties.

    virtual void setVideoEncoderConfiguration(AliRtcVideoEncoderConfiguration &config) = 0;

    Parameter description

    Parameter

    Type

    Description

    config

    AliRtcVideoEncoderConfiguration

    Predefined video encoding properties.

  • setScreenShareSourceByRegion: Share the source by specifying the locale screen.

    Note

    This method is only applicable to desktop sharing. To set up window sharing, use the setScreenShareSource interface.

    virtual int setScreenShareSourceByRegion(const AliRtcScreenShareRegion& screenRect, bool isShareByRegion, const AliRtcScreenShareRegion& regionRect) = 0;

    Parameter description

    Parameter

    Type

    Description

    screenRect

    AliRtcScreenShareRegion

    Specifies the location of the screen to share relative to the virtual screen. For more information about virtual screen locations, see The Virtual Screen.

    isShareByRegion

    bool

    Specifies whether to share only specific areas within the specified screen.

    regionRect

    AliRtcScreenShareRegion

    Specifies the area to share within the shared screen (you must assign a value only if the isShareByRegion is true).

    Note
    • The minimum resolution of the shared area is 16 x 16. If the set area is less than the minimum resolution, it is reset to the minimum resolution.

    • If the sharing area exceeds the actual desktop resolution, the entire desktop will be shared.

  • stopRecord: stops recording.

    virtual void stopRecord() = 0;                   
  • getDesktopResolution: Get the screen sharing desktop resolution.

    int getDesktopResolution(const AliRtc::String& source_id, const AliRtc::String& source_title, int& width, int& height)

    Parameter description

    Parameter

    Type

    Description

    source_id

    AliRtc::String

    The ID of the screen sharing data source.

    source_title

    AliRtc::String

    The name of the screen sharing data source.

    width

    int

    The screen resolution is wide.

    height

    int

    High screen resolution.

    Return result

    0 indicates that the method call was successful. Other indicates that the method call failed.

  • setScreenShareSource: Specify the screen sharing source.

    int setScreenShareSource(const AliRtcScreenSource& source)

    Parameter description

    Parameter

    Type

    Description

    source

    AliRtcScreenSource

    The screen shares source information.

    Return result

    0 indicates that the method call was successful. Other indicates that the method call failed.

  • getScreenShareSource: Get the screen sharing source.

    AliRtcScreenSource getScreenShareSource()

    Return result

    Returns the screen sharing source for the current settings.

  • setAudioOnlyMode: Set this parameter to audio-only mode or audio-video mode.

    int setAudioOnlyMode(bool audioOnly)              

    Parameter description

    Parameter

    Type

    Description

    audioOnly

    bool

    true indicates audio publishing and subscription. false indicates audio publishing and subscription. Default value: false.

    Return result

    0 indicates that the method call was successful. Other indicates that the method call failed.

    Important

    This interface must be called before joining the channel.

  • isAudioOnly: queries whether the current audio-only mode is displayed.

    bool isAudioOnly()

    Return result

    true indicates the audio-only mode. false indicates the audio-video mode.

  • muteLocalMic: specifies whether to stop publishing local audio.

    int muteLocalMic(bool mute)                   

    Parameter description

    Parameter

    Type

    Description

    mute

    bool

    true indicates that local audio is stopped. false indicates that local audio is resumed. By default, local audio is restored and published.

    Return result

    0 indicates that the method call was successful. -1 indicates that the method call failed.

    Important

    This interface does not change the collection status of the current audio.

  • muteRemoteAudioPlaying: specifies whether to stop playing the remote audio stream.

    int muteRemoteAudioPlaying(const AliRtc::String& uid, bool mute)                 

    Parameter description

    Parameter

    Type

    Description

    uid

    const AliRtc::String&

    The ID of the user.

    mute

    bool

    true indicates that playback is stopped. false indicates that playback is resumed.

    Return result

    0 indicates that the method call was successful. -1 indicates that the method call failed.

  • getAudioCaptures: Obtains a list of recording devices in the system.

    void getAudioCaptures(AliRtc::StringArray& array)

    Parameter description

    Parameter

    Type

    Description

    array

    AliRtc::StringArray&

    The list of audio collection devices.

  • getCurrentAudioCapture: obtains the currently used audio collection device name.

    AliRtc::String getCurrentAudioCapture()
  • setCurrentAudioCapture: Select an audio capture device.

    void setCurrentAudioCapture(const AliRtc::String& capture)

    Parameter description

    Parameter

    Type

    Description

    capture

    String

    The audio collection device name.

    Important

    This interface can be called only after the interface is getAudioCaptures.

  • getAudioRenderers: Get the list of speakers in the system.

    void getAudioRenderers(AliRtc::StringArray& array)

    Parameter description

    Parameter

    Type

    Description

    array

    AliRtc::StringArray&

    The list of audio playback devices.

  • getCurrentAudioRenderer: obtains the currently used audio playback device.

    AliRtc::String getCurrentAudioRenderer()
  • setCurrentAudioRenderer: Select an audio playback device.

    void setCurrentAudioRenderer(const AliRtc::String &renderer)

    Parameter description

    Parameter

    Type

    Description

    renderer

    String

    The audio playback device name.

    Important

    This operation can be called only after getAudioRenderers.

  • startAudioCapture: enables audio collection.

    void startAudioCapture() = 0;
    Important

    You can enable audio collection in advance. If you do not set this parameter, the SDK enables audio collection when stream ingest starts.

  • stopAudioCapture: Disables audio collection.

    void stopAudioCapture();
    Important

    You can set to disable audio collection.

  • startAudioPlayer: enables the audio playback device.

     void startAudioPlayer();
    Important

    You can enable audio playback in advance. If you do not set this parameter, the SDK will enable audio playback when the subscription succeeds.

  • stopAudioPlayer: Disables audio playback.

    void stopAudioPlayer();
    Important
    • You can set to disable audio playback.

    • This operation is called before joining.

  • muteAllRemoteAudioPlaying: Stops playback of all audio streams at the remote end.

    virtual int muteAllRemoteAudioPlaying(bool mute)

    Parameter description

    Parameter

    Type

    Description

    mute

    bool

    true indicates that audio stream playback is stopped. false indicates that audio stream playback is not stopped. By default, audio stream playback is not stopped.

    Important

    After this operation is called, subscription and decoding are not affected.

  • getCurrentAudioCaptureId: obtains the ID of the used recording device.

    virtual AliRtc::String getCurrentAudioCaptureId()
  • setCurrentAudioCaptureById: Select a recording device by device ID.

    virtual void setCurrentAudioCaptureById(const AliRtc::String &captureId)

    Parameter description

    Parameter

    Type

    Description

    captureId

    const AliRtc::String &

    The recording device ID. Gets from the getAudioCaptures interface.

  • getCurrentAudioRendererId : obtains the ID of the speaker currently in use.

    virtual AliRtc::String getCurrentAudioRendererId()
  • setCurrentAudioRendererById: Select the speaker by device ID.

    virtual void setCurrentAudioRendererById(const AliRtc::String &rendererId)

    Parameter description

    Parameter

    Type

    Description

    rendererId

    const AliRtc::String &

    The ID of the speaker. Gets from the getAudioRenderers interface.

  • setRecordingVolume: Set the recording volume.

    virtual int setRecordingVolume(int volume)

    Parameter description

    Parameter

    Type

    Description

    volume

    int

    Volume. Valid values: 0 to 400. The default value is 100.

    • 0: mute.

    • Greater than 100: magnifies the volume.

    • Less than 100: Reduce the volume.

    Return result

    0 indicates that the method call was successful. Other indicates that the method call failed.

    Important

    Recording volume adjustment: This interface can be called when the physical key of the peer user is increased to the maximum and still feels that the sound is played hours. The recommended value is 100-200. If the value exceeds the 200, the sound quality will be affected.

  • setPlayoutVolume: Set the playback volume.

    virtual int setPlayoutVolume(int volume)

    Parameter description

    Parameter

    Type

    Description

    volume

    int

    Volume. Valid values: 0 to 400. The default value is 100.

    • 0: mute.

    • Greater than 100: magnifies the volume.

    • Less than 100: Reduce the volume.

    Return result

    0 indicates that the method call was successful. Other indicates that the method call failed.

    Important

    When the local physical key is adjusted to the maximum and you still feel that the sound is played hours, you can call this interface. The recommended value is 100-200. If the value exceeds the 200, the sound quality will be affected.

  • setSubscribeAudioNumChannel: Set the number of output audio channels.

    virtual void setSubscribeAudioNumChannel(AliRtcAudioNumChannelType audioNumChannel)

    Parameter description

    Parameter

    Type

    Description

    audioNumChannel

    AliRtcAudioNumChannelType

    The type of the audio channel. The default value is Mono.

  • setSubscribeAudioSampleRate: Set the output audio sample rate.

    virtual void setSubscribeAudioSampleRate(AliRtcAudioSampleRate audioSampleRate)

    Parameter description

    Parameter

    Type

    Description

    audioSampleRate

    AliRtcAudioSampleRate

    The audio sample rate. The default value is 44.1k.

  • setExternalAudioSource: specifies whether to use external audio data as the input source for streaming.

    virtual int setExternalAudioSource(bool enable, unsigned int sampleRate, unsigned int channelsPerFrame)

    Parameter description

    Parameter

    Type

    Description

    enable

    bool

    true indicates that the external audio input source is enabled. false indicates that the external audio input source is not enabled. By default, external video input sources are not enabled.

    sampleRate

    unsigned int

    The sampling rate.

    channelsPerFrame

    unsigned int

    The number of sound channels. The value must be greater than or equal to 1.

    Return result

    If the return value is greater than or equal to 0, the method call is successful. Others indicate that the method call fails.

  • pushExternalAudioFrameRawData: Input audio data.

    virtual int pushExternalAudioFrameRawData(const void* audioSamples, unsigned int sampleLength, long long timestamp)

    Parameter description

    Parameter

    Type

    Description

    audioSamples

    const void*

    The audio data.

    sampleLength

    unsigned int

    The length of the audio data.

    timestamp

    long long

    Timestamp.

    Return result

    • If the return value is greater than or equal to 0, the method call is successful.

    • If the return value is less than 0, the method call failed.

    • A return value of ERR_AUDIO_BUFFER_FULL indicates that the delivery needs to be retried again after the length of time the data is delivered at the interval.

  • setMixedWithMic: Specify whether the external audio input is mixed with the microphone to collect audio.

    virtual int setMixedWithMic(bool mixed)

    Parameter description

    Parameter

    Type

    Description

    mixed

    bool

    true indicates that the external audio input is mixed with the microphone-collected audio. false indicates that the external audio input completely replaces the microphone-collected audio. The default is full substitution.

    Return result

    0 indicates that the setting is successful. Others indicate that the setting fails.

  • setExternalAudioPublishVolume: Set the external audio input volume.

    virtual int setExternalAudioPublishVolume(int volume)

    Parameter description

    Parameter

    Type

    Description

    volume

    int

    Volume. Valid values: 0 to 100. The default value is 100.

    Return result

    0 indicates that the setting is successful. Others indicate that the setting fails.

    Important

    The name of the setExternalAudioVolume interface is changed to setExternalAudioPublishVolume in versions 1.17 and later.

  • getExternalAudioPublishVolume: obtains the external audio input volume.

    virtual int getExternalAudioPublishVolume()

    Return result

    A value greater than or equal to 0 indicates that the method call is successful. Other error codes are returned when the method call fails.

    Important

    The method name of 1.17 and later versions is getExternalAudioVolume changed to getExternalAudioPublishVolume.

  • setExteranlAudioRender: specifies whether to enable external input audio playback.

    virtual int setExteranlAudioRender(bool enable, unsigned int sampleRate, unsigned int channelsPerFrame)

    Parameter description

    Parameter

    Type

    Description

    enable

    bool

    true indicates that external input audio playback is enabled. false indicates that external input audio playback is disabled. By default, external input audio playback is disabled.

    sampleRate

    unsigned int

    The sampling rate.

    channelsPerFrame

    unsigned int

    The sampling rate.

    Return result

    If the return value is greater than or equal to 0, the method call is successful. Others indicate that the method call fails.

  • pushExternalAudioRenderRawData: Enter audio playback data.

    virtual int pushExternalAudioRenderRawData(const void* audioSamples, unsigned int sampleLength, 
    unsigned int sampleRate, unsigned int channelsPerFrame, long long timestamp)

    Parameter description

    Parameter

    Type

    Description

    audioSamples

    const void*

    The audio data.

    sampleLength

    unsigned int

    The length of the audio data.

    sampleRate

    unsigned int

    The audio sample rate.

    channelsPerFrame

    unsigned int

    The number of audio channels.

    timestamp

    long long

    Timestamp.

    Return result

    If the return value is greater than or equal to 0, the method call is successful. Others indicate that the method call fails.

  • setExternalAudioPlayoutVolume: Set the external audio playback volume.

    virtual int setExternalAudioPlayoutVolume(int volume)

    Parameter description

    Parameter

    Type

    Description

    volume

    int

    Volume. Valid values: 0 to 100. The default value is 100.

    Return result

    0 indicates that the setting is successful. Others indicate that the setting fails.

  • getExternalAudioPlayoutVolume: obtains the audio playback volume.

    virtual int getExternalAudioPlayoutVolume()
  • setAudioEffectReverbMode: sets the reverb mode.

    virtual int setAudioEffectReverbMode(const AliRtcAudioEffectReverbMode mode) = 0;

    Parameter description

    Parameter

    Type

    Description

    mode

    const AliRtcAudioEffectReverbMode

    Corresponding reverb sound effect type. No reverb mode by default.

    Return result

    0 indicates that the method call was successful, and other error codes returned that indicate that the method call failed.

  • setAudioEffectReverbParamType: Set the reverb effect type.

    virtual int setAudioEffectReverbParamType(const AliRtcAudioEffectReverbParamType type, float value) = 0;

    Parameter description

    Parameter

    Type

    Description

    type

    const AliRtcAudioEffectReverbParamType

    Corresponding reverb sound effect type.

    value

    float

    Corresponding reverb sound effect type value.

    Return result

    0 indicates that the method call was successful, and other error codes returned that indicate that the method call failed.

  • setVolumeCallbackIntervalMs: Set the volume callback frequency and smoothing factor. The return value of 0 indicates success. -1 indicates that the interval is set to less than 10. -2 indicates that the smoothing coefficient is out of range.

    virtual int setVolumeCallbackIntervalMs(int interval, int smooth, int reportVad) = 0;

    Parameter description

    Parameter

    Type

    Description

    interval

    int

    The time interval. Unit: ms. The minimum value must not be less than 10ms. Default value: 160ms.

    smooth

    int

    The smoothing coefficient. The larger the value, the higher the degree of smoothness, and vice versa, the lower the value, the better the real-time performance. We recommend that you set 3, which ranges from 0 to 9.

    reportVad

    int

    The local voice detection switch. Valid values:

    • 1: enables callback through the onAudioVolumeCallback interface.

    • 0: disables the trace flag.

    Return result

    • 0 indicates that the method call is successful.

    • -1 indicates that the interval setting is less than 10

    • -2 indicates that the smoothing coefficient is out of range.

  • setRecordingDeviceVolume: Set the audio collection device volume.

    virtual int setRecordingDeviceVolume(int volume) = 0;

    Parameter description

    Parameter

    Type

    Description

    volume

    int

    The volume. Valid values: 0 to 100. The default value is 100.

  • getRecordingDeviceVolume: obtains the audio collection device volume.

    virtual int getRecordingDeviceVolume() = 0;

    Return result

    Returns the current audio collection device volume.

  • setPlaybackDeviceVolume: Set the audio playback device volume.

    virtual int setPlaybackDeviceVolume(int volume) = 0;

    Parameter description

    Parameter

    Type

    Description

    volume

    int

    The volume. Valid values: 0 to 100. The default value is 100.

    Return result

    The value 0 indicates a request success. A value that is not 0 indicates a request failure.

  • getPlaybackDeviceVolume: obtains the audio playback device volume.

    virtual int getPlaybackDeviceVolume() = 0;

    Return result

    Returns the current audio playback device volume.

  • startPreview: starts the local preview (called by the main thread).

    int startPreview()              

    Return result

    The value 0 indicates a request success. A value that is not 0 indicates a request failure.

    Important

    This interface needs to be called by the main thread after setLocalViewConfig. You can call this operation before you join a channel.

  • stopPreview: stops local preview.

    int stopPreview()                  

    Return result

    The value 0 indicates a request success. A value that is not 0 indicates a request failure.

  • getOnlineRemoteUsers: Obtains the list of remote online users.

    void getOnlineRemoteUsers(AliRtc::StringArray& array)

    Parameter description

    Parameter

    Type

    Description

    array

    AliRtc::StringArray&

    User list (user ID list).

  • getUserInfo: queries remote user information. If 0 is returned, it indicates that the acquisition is successful. If others are returned, it indicates that the acquisition fails.

    int getUserInfo(const AliRtc::String& uid, AliRtc::Dictionary& dict)

    Parameter description

    Parameter

    Type

    Description

    uid

    const AliRtc::String&

    The ID of the user.

    dict

    AliRtc::Dictionary&

    Used to store user data. Valid values:

    In dict, key values include userID, isOnline, sessionID, callID, displayName, hasAudio,hasCameraMaster, hasCameraSlave, hasScreenSharing, requestAudio,requestCameraMaster, requestCameraSlave, requestScreenSharing, preferCameraMaster subScribedAudio, subScribedCameraMaster,subScribedCamearSlave, subScribedScreenSharing, hasCameraView, hasScreenView, and muteAudioPlaying.

    Return result

    0 indicates that the method call was successful. Other indicates that the method call failed.

  • isUserOnline: queries whether a user is online.

    bool isUserOnline(const AliRtc::String& uid)

    Parameter description

    Parameter

    Type

    Description

    uid

    const AliRtc::String&

    The ID of the user.

    Return result

    true indicates that the user is online. false indicates that the user is not online.

  • createMediaDeviceTestInterface: creates an audio and video device test instance.

    AliMediaDeviceTestInterface * createMediaDeviceTestInterface(AliMediaDeviceTestEventListener * pMediaDeviceEventListener)

    Parameter description

    Parameter

    Type

    Description

    pMediaDeviceEventListener

    AliMediaDeviceTestEventListener *

    Audio device test event listener.

  • setLogLevel: specifies the log level.

    void setLogLevel(AliRtcLogLevel logLevel)        

    Parameter description

    Parameter

    Type

    Description

    logLevel

    AliRtcLogLevel

    The level of the log entry. The default value is AliRtcLogLevelInfo.

  • getSdkVersion: obtains the SDK version number.

    static const char* getSdkVersion()                 
  • setClientRole: specifies a user role. 0 is returned as success. Otherwise, an error code is returned.

    int setClientRole(const AliRtcClientRole clientRole) = 0;

    Parameter description

    Parameter

    Type

    Description

    clientRole

    AliRtcClientRole

    The user role. The default value is AliRtcClientRoleLive.

    Return result

    0 indicates that the method call was successful. Other error codes indicating that the method call failed.

  • startLastmileDetect: starts network quality detection.

    Note

    You need to call before joining the channel, and it will automatically stop after joining the channel. The detection result is called back in the onLastmileDetectResultWithQuality.

    virtual int startLastmileDetect()

    Return result

    0 indicates that the method call was successful. Other indicates that the method call failed.

  • stopLastmileDetect: stops network quality detection.

    virtual int stopLastmileDetect()
  • postFeedback: feedback on SDK issues.

        virtual void postFeedback(const AliRtc::String& uid, const AliRtc::String& channelId,
          const AliRtc::String& description, AliRtcFeedbackType type, long long timeStamp) = 0;

    Parameter description

    Parameter

    Type

    Description

    uid

    AliRtc::String

    User ID of the problem user.

    channelId

    AliRtc::String

    The ID of the channel in question.

    description

    AliRtc::String

    The question description.

    type

    AliRtcFeedbackType

    The type of the problem.

    timeStamp

    long long

    The timestamp when the problem occurred.

  • sendMediaExtensionMsg: sends media extension information.

    • 0: The message is sent.

    • -1: You cannot send custom messages because they are not in the ingest state.

    • -2: The parameter is set incorrectly. The length of the custom message exceeds 8 bytes, or repeatCount<=0.

    • -3: The sending frequency is too frequent. We recommend that you reduce the sending frequency.

    Note

    To use audio and video tunnel to send custom messages to other users in the room, two prerequisites need to be met:

    • You join the club normally and are in the stream.

    • Other users in the room need to subscribe to their own audio and video streams. After successful transmission, they can receive the results in the onMediaExtensionMsgReceived callback.

    virtual int sendMediaExtensionMsg(unsigned char *message, int size, int repeatCount) = 0;

    Parameter description

    Parameter

    Type

    Description

    message

    unsigned char *

    Custom message data.

    size

    int

    The length of the custom message data. Currently, the length is limited to 8 bytes.

    repeatCount

    int

    The number of times a message was sent.

  • getClientRole: obtains the user role.

     virtual AliRtcClientRole getClientRole() = 0;
  • startIntelligentDenoise: Enable intelligent noise reduction. By default, this switch is turned off.

    virtual void startIntelligentDenoise() = 0;
    Important

    This interface can control and turn on the intelligent noise reduction function during the call.

  • stopIntelligentDenoise: disables intelligent noise reduction.

     virtual void stopIntelligentDenoise() = 0;
    Important

    This interface can control and disable the intelligent noise reduction function during a call.

  • RefreshAuthInfo: Refresh the token.

     virtual int RefreshAuthInfo(const AliRtcAuthInfo& authInfo) = 0;

    Parameter description

    Parameter

    Type

    Description

    authInfo

    AliRtcAuthInfo

    The new authentication information.

    Return result

    0 indicates that the token is successfully refreshed, and others indicate that the token fails to be refreshed.