UNPKG

agora-rtc-sdk-ng-test

Version:
1,253 lines (1,202 loc) 258 kB
import { IAudioProcessor } from 'agora-rte-extension'; import { IBaseProcessor } from 'agora-rte-extension'; import { IExtension } from 'agora-rte-extension'; declare const AgoraRTC: IAgoraRTC; export default AgoraRTC; /** * @ignore */ declare class AgoraRTCError extends AgoraRTCError_2 { readonly name: string; constructor(code: AgoraRTCErrorCode, message?: string, data?: any); print(level?: "error" | "warning"): AgoraRTCError; throw(): never; } /** * @ignore */ declare class AgoraRTCError_2 extends Error implements IAgoraRTCError { readonly code: AgoraRTCErrorCode; readonly message: string; readonly data?: any; readonly name: string; constructor(code: AgoraRTCErrorCode, message?: string, data?: any); toString(): string; print(level?: "error" | "warning", logger?: any): AgoraRTCError_2; throw(logger?: any): never; } /** * @ignore */ export declare enum AgoraRTCErrorCode { UNEXPECTED_ERROR = "UNEXPECTED_ERROR", UNEXPECTED_RESPONSE = "UNEXPECTED_RESPONSE", TIMEOUT = "TIMEOUT", INVALID_PARAMS = "INVALID_PARAMS", NOT_READABLE = "NOT_READABLE", NOT_SUPPORTED = "NOT_SUPPORTED", INVALID_OPERATION = "INVALID_OPERATION", OPERATION_ABORTED = "OPERATION_ABORTED", WEB_SECURITY_RESTRICT = "WEB_SECURITY_RESTRICT", EXCHANGE_SDP_FAILED = "EXCHANGE_SDP_FAILED", ADD_CANDIDATE_FAILED = "ADD_CANDIDATE_FAILED", DATACHANNEL_FAILED = "DATACHANNEL_FAILED", NETWORK_ERROR = "NETWORK_ERROR", NETWORK_TIMEOUT = "NETWORK_TIMEOUT", NETWORK_RESPONSE_ERROR = "NETWORK_RESPONSE_ERROR", API_INVOKE_TIMEOUT = "API_INVOKE_TIMEOUT", ENUMERATE_DEVICES_FAILED = "ENUMERATE_DEVICES_FAILED", DEVICE_NOT_FOUND = "DEVICE_NOT_FOUND", ELECTRON_IS_NULL = "ELECTRON_IS_NULL", ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR = "ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR", CHROME_PLUGIN_NO_RESPONSE = "CHROME_PLUGIN_NO_RESPONSE", CHROME_PLUGIN_NOT_INSTALL = "CHROME_PLUGIN_NOT_INSTALL", MEDIA_OPTION_INVALID = "MEDIA_OPTION_INVALID", PERMISSION_DENIED = "PERMISSION_DENIED", CONSTRAINT_NOT_SATISFIED = "CONSTRAINT_NOT_SATISFIED", TRACK_IS_DISABLED = "TRACK_IS_DISABLED", GET_VIDEO_ELEMENT_VISIBLE_ERROR = "GET_VIDEO_ELEMENT_VISIBLE_ERROR", SHARE_AUDIO_NOT_ALLOWED = "SHARE_AUDIO_NOT_ALLOWED", LOW_STREAM_ENCODING_ERROR = "LOW_STREAM_ENCODING_ERROR", SET_ENCODING_PARAMETER_ERROR = "SET_ENCODING_PARAMETER_ERROR", TRACK_STATE_UNREACHABLE = "TRACK_STATE_UNREACHABLE", INVALID_UINT_UID_FROM_STRING_UID = "INVALID_UINT_UID_FROM_STRING_UID", CAN_NOT_GET_PROXY_SERVER = "CAN_NOT_GET_PROXY_SERVER", CAN_NOT_GET_GATEWAY_SERVER = "CAN_NOT_GET_GATEWAY_SERVER", VOID_GATEWAY_ADDRESS = "VOID_GATEWAY_ADDRESS", UID_CONFLICT = "UID_CONFLICT", MULTI_UNILBS_RESPONSE_ERROR = "MULTI_UNILBS_RESPONSE_ERROR", UPDATE_TICKET_FAILED = "UPDATE_TICKET_FAILED", TOKEN_EXPIRE = "TOKEN_EXPIRE", INVALID_LOCAL_TRACK = "INVALID_LOCAL_TRACK", INVALID_TRACK = "INVALID_TRACK", SENDER_NOT_FOUND = "SENDER_NOT_FOUND", CREATE_OFFER_FAILED = "CREATE_OFFER_FAILED", SET_ANSWER_FAILED = "SET_ANSWER_FAILED", ICE_FAILED = "ICE_FAILED", PC_CLOSED = "PC_CLOSED", SENDER_REPLACE_FAILED = "SENDER_REPLACE_FAILED", GET_LOCAL_CAPABILITIES_FAILED = "GET_LOCAL_CAPABILITIES_FAILED", GET_LOCAL_CONNECTION_PARAMS_FAILED = "GET_LOCAL_CONNECTION_PARAMS_FAILED", SUBSCRIBE_FAILED = "SUBSCRIBE_FAILED", UNSUBSCRIBE_FAILED = "UNSUBSCRIBE_FAILED", GATEWAY_P2P_LOST = "GATEWAY_P2P_LOST", NO_ICE_CANDIDATE = "NO_ICE_CANDIDATE", CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS = "CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS", EXIST_DISABLED_VIDEO_TRACK = "EXIST_DISABLED_VIDEO_TRACK", INVALID_REMOTE_USER = "INVALID_REMOTE_USER", REMOTE_USER_IS_NOT_PUBLISHED = "REMOTE_USER_IS_NOT_PUBLISHED", CUSTOM_REPORT_SEND_FAILED = "CUSTOM_REPORT_SEND_FAILED", CUSTOM_REPORT_FREQUENCY_TOO_HIGH = "CUSTOM_REPORT_FREQUENCY_TOO_HIGH", FETCH_AUDIO_FILE_FAILED = "FETCH_AUDIO_FILE_FAILED", READ_LOCAL_AUDIO_FILE_ERROR = "READ_LOCAL_AUDIO_FILE_ERROR", DECODE_AUDIO_FILE_FAILED = "DECODE_AUDIO_FILE_FAILED", WS_ABORT = "WS_ABORT", WS_DISCONNECT = "WS_DISCONNECT", WS_ERR = "WS_ERR", EXTERNAL_SIGNAL_ABORT = "EXTERNAL_SIGNAL_ABORT", LIVE_STREAMING_TASK_CONFLICT = "LIVE_STREAMING_TASK_CONFLICT", LIVE_STREAMING_INVALID_ARGUMENT = "LIVE_STREAMING_INVALID_ARGUMENT", LIVE_STREAMING_INTERNAL_SERVER_ERROR = "LIVE_STREAMING_INTERNAL_SERVER_ERROR", LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED = "LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED", LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED = "LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED", LIVE_STREAMING_CDN_ERROR = "LIVE_STREAMING_CDN_ERROR", LIVE_STREAMING_INVALID_RAW_STREAM = "LIVE_STREAMING_INVALID_RAW_STREAM", LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT = "LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT", LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE = "LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE", LIVE_STREAMING_WARN_FREQUENT_REQUEST = "LIVE_STREAMING_WARN_FREQUENT_REQUEST", WEBGL_INTERNAL_ERROR = "WEBGL_INTERNAL_ERROR", BEAUTY_PROCESSOR_INTERNAL_ERROR = "BEAUTY_PROCESSOR_INTERNAL_ERROR", CROSS_CHANNEL_WAIT_STATUS_ERROR = "CROSS_CHANNEL_WAIT_STATUS_ERROR", CROSS_CHANNEL_FAILED_JOIN_SRC = "CROSS_CHANNEL_FAILED_JOIN_SEC", CROSS_CHANNEL_FAILED_JOIN_DEST = "CROSS_CHANNEL_FAILED_JOIN_DEST", CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST = "CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST", CROSS_CHANNEL_SERVER_ERROR_RESPONSE = "CROSS_CHANNEL_SERVER_ERROR_RESPONSE", METADATA_OUT_OF_RANGE = "METADATA_OUT_OF_RANGE", LOCAL_AEC_ERROR = "LOCAL_AEC_ERROR", INVALID_PLUGIN = "INVALID_PLUGIN", DISCONNECT_P2P = "DISCONNECT_P2P", CONVERTING_IMAGEDATA_TO_BLOB_FAILED = "CONVERTING_IMAGEDATA_TO_BLOB_FAILED", CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED = "CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED", INIT_DATACHANNEL_TIMEOUT = "INIT_DATACHANNEL_TIMEOUT", CREATE_DATACHANNEL_ERROR = "CREATE_DATACHANNEL_ERROR", DATACHANNEL_CONNECTION_TIMEOUT = "DATACHANNEL_CONNECTION_TIMEOUT", PROHIBITED_OPERATION = "PROHIBITED_OPERATION", IMAGE_MODERATION_UPLOAD_FAILED = "IMAGE_MODERATION_UPLOAD_FAILED", P2P_MESSAGE_FAILED = "P2P_MESSAGE_FAILED" } /** * Statistics of the call, which can be retrieved by calling [AgoraRTCClient.getRTCStats]{@link IAgoraRTCClient.getRTCStats}. */ export declare interface AgoraRTCStats { /** * Call duration in seconds. */ Duration: number; /** * The total bitrate (bps) of the received audio and video, represented by an instantaneous value. */ RecvBitrate: number; /** * The total number of bytes received, represented by an aggregate value. */ RecvBytes: number; /** * The total bitrate (bps) of the sent audio and video, represented by an instantaneous value. */ SendBitrate: number; /** * The total number of bytes sent, represented by an aggregate value. */ SendBytes: number; /** * The number of users in the channel. * * - Communication profile: The number of users in the channel. * - Live Broadcast profile: * - If the local user is an audience: The number of users in the channel = The number of hosts in the channel + 1. * - If the local user is a host: The number of users in the channel = The number of hosts in the channel. */ UserCount: number; /** * RTT (Round-Trip Time) between the SDK and Agora's edge server, in ms. */ RTT: number; /** * The estimated bandwidth (Kbps) of the uplink network. */ OutgoingAvailableBandwidth: number; } declare enum AppType { APP_TYPE_INVALID_VALUE = -1, APP_TYPE_NATIVE = 0, APP_TYPE_NATIVE_COCOS = 1, APP_TYPE_NATIVE_UNITY = 2, APP_TYPE_NATIVE_ELECTRON = 3, APP_TYPE_NATIVE_FLUTTER = 4, APP_TYPE_NATIVE_UNREAL = 5, APP_TYPE_NATIVE_XAMARIN = 6, APP_TYPE_NATIVE_API_CLOUD = 7, APP_TYPE_NATIVE_REACT_NATIVE = 8, APP_TYPE_NATIVE_PYTHON = 9, APP_TYPE_NATIVE_COCOS_CREATOR = 10, APP_TYPE_NATIVE_RUST = 11, APP_TYPE_NATIVE_C_SHARP = 12, APP_TYPE_NATIVE_CEF = 13, APP_TYPE_NATIVE_UNI_APP = 14, APP_TYPE_WEBRTC = 1000, APP_TYPE_WEBRTC_REACT = 1001, APP_TYPE_WEBRTC_VUE = 1002, APP_TYPE_WEBRTC_ANGULAR = 1003 } /** * Regions for the connection. Used for calling [AgoraRTC.setArea]{@link IAgoraRTC.setArea}. */ export declare enum AREAS { /** * China. */ CHINA = "CHINA", /** * Asia, excluding Mainland China. */ ASIA = "ASIA", /** * North America. */ NORTH_AMERICA = "NORTH_AMERICA", /** * Europe. */ EUROPE = "EUROPE", /** * Japan. */ JAPAN = "JAPAN", /** * India. */ INDIA = "INDIA", /** * @ignore */ KOREA = "KOREA", /** * @ignore */ HKMC = "HKMC", /** * @ignore */ US = "US", /** * @ignore */ OCEANIA = "OCEANIA", /** * @ignore */ SOUTH_AMERICA = "SOUTH_AMERICA", /** * @ignore */ AFRICA = "AFRICA", /** * @ignore */ OVERSEA = "OVERSEA", /** * Global. */ GLOBAL = "GLOBAL", /** * @ignore */ EXTENSIONS = "EXTENSIONS" } /** * * The latency level of an audience member in a live interactive streaming. Takes effect only when the user role is `"audience"`. * - `1`: Low latency. * - `2`: (Default) Ultra low latency. */ export declare enum AudienceLatencyLevelType { /** * Low latency. */ AUDIENCE_LEVEL_LOW_LATENCY = 1, /** * Ultra-low latency. */ AUDIENCE_LEVEL_ULTRA_LOW_LATENCY = 2, /** * @ignore */ AUDIENCE_LEVEL_SYNC_LATENCY = 3 } /** * @ignore */ declare const AUDIO_ENCODER_CONFIG_SETTINGS: { speech_low_quality: AudioEncoderConfiguration; speech_standard: AudioEncoderConfiguration; music_standard: AudioEncoderConfiguration; standard_stereo: AudioEncoderConfiguration; high_quality: AudioEncoderConfiguration; high_quality_stereo: AudioEncoderConfiguration; }; declare enum AudioCodec { opus = "opus", pcma = "pcma", pcmu = "pcmu", g722 = "g722" } /** * * `AudioEncoderConfiguration` is the interface that defines the audio encoder configurations. * * You can customize the audio encoder configurations when calling [AgoraRTC.createCustomAudioTrack]{@link IAgoraRTC.createCustomAudioTrack}, [AgoraRTC.createMicrophoneAudioTrack]{@link IAgoraRTC.createMicrophoneAudioTrack} or [AgoraRTC.createBufferSourceAudioTrack]{@link IAgoraRTC.createBufferSourceAudioTrack}. */ export declare interface AudioEncoderConfiguration { /** * Sample rate of the audio (Hz). */ sampleRate?: number; /** * Sample size of the audio. */ sampleSize?: number; /** * Whether to enable stereo. */ stereo?: boolean; /** * Bitrate of the audio (Kbps). */ bitrate?: number; } /** * The preset audio encoder configurations. * * You can pass the preset video encoder configurations when calling the following methods: * - [AgoraRTC.createCustomAudioTrack]{@link IAgoraRTC.createCustomAudioTrack} * - [AgoraRTC.createMicrophoneAudioTrack]{@link IAgoraRTC.createMicrophoneAudioTrack} * - [AgoraRTC.createBufferSourceAudioTrack]{@link IAgoraRTC.createBufferSourceAudioTrack} * * The following table lists all the preset audio profiles. The SDK uses `"music_standard"` by default. * * | Audio Profile | Configurations | * | -------- | --------------- | * |`"speech_low_quality"`|Sample rate 16 kHz, mono, encoding bitrate 24 Kbps| * |`"speech_standard"`|Sample rate 32 kHz, mono, encoding bitrate 24 Kbps| * |`"music_standard"`|Sample rate 48 kHz, mono, encoding bitrate 32 Kbps| * |`"standard_stereo"`|Sample rate 48 kHz, stereo, encoding bitrate 64 Kbps| * |`"high_quality"`|Sample rate 48 kHz, mono, encoding bitrate 128 Kbps| * |`"high_quality_stereo"`|Sample rate 48 kHz, stereo, encoding bitrate 192 Kbps| Kbps. * @public */ export declare type AudioEncoderConfigurationPreset = keyof typeof AUDIO_ENCODER_CONFIG_SETTINGS; /** * Options for processing the audio buffer. You need to set the options for processing the audio buffer when calling [startProcessAudioBuffer]{@link IBufferSourceAudioTrack.startProcessAudioBuffer}. */ export declare interface AudioSourceOptions { /** * How many times the audio loops. */ cycle?: number; /** * Whether to loop the audio infinitely. */ loop?: boolean; /** * The playback position (seconds). */ startPlayTime?: number; } /** * Processing state of the audio buffer: * - `"stopped"`: The SDK stops processing the audio buffer. Reasons may include: * - The SDK finishes processing the audio buffer. * - The user manually stops the processing of the audio buffer. * - `"playing"`: The SDK is processing the audio buffer. * - `"paused"`: The SDK pauses processing the audio buffer. * * You can get the state with [BufferSourceAudioTrack.on("source-state-change")]{@link IBufferSourceAudioTrack.event_source_state_change}. */ export declare type AudioSourceState = "stopped" | "playing" | "paused"; /** * Configurations for the audio track of screen sharing. */ declare interface AudioTrackInitConfig { /** * Whether to enable acoustic echo cancellation: * - `true`: Enable acoustic echo cancellation. * - `false`: Do not enable acoustic echo cancellation. */ AEC?: boolean; /** * Whether to enable audio gain control: * - `true`: Enable audio gain control. * - `false`: Do not enable audio gain control. */ AGC?: boolean; /** * Whether to enable automatic noise suppression: * - `true`: Enable automatic noise suppression. * - `false`: Do not automatic noise suppression. */ ANS?: boolean; } /** * @ignore * * Image enhancement options. You need to set the image enhancement options when calling [setBeautyEffect]{@link ILocalVideoTrack.setBeautyEffect}. */ export declare interface BeautyEffectOptions { /** * * The smoothness level. * * The value range is [0.0, 1.0]. The original smoothness level is 0.0. The default value is 0.5. This parameter is usually used to remove blemishes. */ smoothnessLevel?: number; /** * The brightness level. * * The value range is [0.0, 1.0]. The original brightness level is 0.0. The default value is 0.7. */ lighteningLevel?: number; /** * The redness level. * * The value range is [0.0, 1.0]. The original redness level is 0.0. The default value is 0.1. This parameter adjusts the red saturation level. */ rednessLevel?: number; /** * The contrast level. Use this together with {@link lighteningLevel}. * - 0: Low contrast level. * - 1: (Default) The original contrast level. * - 2: High contrast level. */ lighteningContrastLevel?: 0 | 1 | 2; } /** * Configurations for the audio track from an audio file or `AudioBuffer` object. Set these configurations when calling [AgoraRTC.createBufferSourceAudioTrack]{@link IAgoraRTC.createBufferSourceAudioTrack}. */ export declare interface BufferSourceAudioTrackInitConfig { /** * The type of the audio source: * - `File`: An [File](https://developer.mozilla.org/en-US/docs/Web/API/File) object, representing a local audio file. * - `string`: The online audio file retrieved from an HTTPS address. Ensure the address supports HTTPS and CORS. * - `AudioBuffer`: An [AudioBuffer](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer) object, representing the raw data in PCM format. */ source: File | string | AudioBuffer; /** * Whether to cache the online file: * - `true`: Cache the online file. * - `false`: (default) Do not cache the online file. */ cacheOnlineFile?: boolean; /** * The audio encoder configurations. * * You can set the audio encoder configurations in either of the following ways: * - Pass the preset audio encoder configurations by using [[AudioEncoderConfigurationPreset]]. * - Pass your customized audio encoder configurations by using [[AudioEncoderConfiguration]]. * * > Firefox does not support setting the audio encoding rate. */ encoderConfig?: AudioEncoderConfiguration | AudioEncoderConfigurationPreset; } /** * Configurations for the video track from the video captured by a camera. Set these configurations when calling [AgoraRTC.createCameraVideoTrack]{@link IAgoraRTC.createCameraVideoTrack}. */ export declare interface CameraVideoTrackInitConfig { /** * The video encoder configurations. * * You can set the video encoder configurations in either of the following ways: * - Pass the preset video encoder configurations by using [[VideoEncoderConfigurationPreset]]. * - Pass your customized video encoder configurations by using [[VideoEncoderConfiguration]]. * - Leave this property empty to use the SDK's default value, `"480p_1"` (resolution: 640 × 480, frame rate: 15 fps, bitrate: 500 Kbps). */ encoderConfig?: VideoEncoderConfiguration | VideoEncoderConfigurationPreset; /** * Whether to user the front camera or the rear camera. * * You can use this parameter to choose between the front camera and the rear camera on a mobile device: * - `"user"`: The front camera. * - `"environment"`: The rear camera. */ facingMode?: VideoFacingModeEnum; /** * Specifies the camera ID. * * You can get a list of the available cameras by calling [AgoraRTC.getCameras]{@link IAgoraRTC.getCameras}. */ cameraId?: string; /** * @since * <br>&emsp;&emsp;&emsp;*4.2.0* * * Sets the video transmission optimization mode. * * You can call this method during a video call, a live streaming or screen sharing to dynamically change the optimization mode. For example, during the screen sharing, before you change the shared content from text to video, you can change the optimization mode from `"detail"` to `"motion"` to ensure smoothness in poor network conditions. * * > Note: This method supports Chrome only. * * @param mode The video transmission optimization mode: * - `"detail"`: Prioritizes video quality. * - The browser ensures high-quality images by automatically calculating a minimum bitrate based on the capturing resolution and frame rate. No matter how poor the network condition is, the sending bitrate will never be lower than the minimum value. * - In most cases, the browser does not reduce the sending resolution, but may reduce the frame rate. * - `"motion"`: Since v4.21.0, the browser prioritizes video smoothness. * - In poor network conditions, the browser reduces the sending bitrate to minimize video freezes. * - In most cases, the browser does not reduce the frame rate, but may reduce the sending resolution. * - `"balanced"`: The default optimization mode. * - For screen sharing video streams, the SDK default optimization strategy is quality-first. * - For other video streams, the SDK default optimization strategy is balanced between quality and smoothness. Under poor network conditions, both the frame rate and resolution will be adjusted. */ optimizationMode?: OptimizationMode; /** * @ignore * * @since * <br>&emsp;&emsp;&emsp;*4.18.0* * * Configurations for Scalable Video Coding (SVC). * * You can set the configurations using one of the following options: * - Use the preset SVC configurations provided by the SDK through {@link SVCConfigurationPreset}. * - Use your custom SVC configurations through {@link SVCConfiguration}. */ scalabiltyMode?: SVCConfiguration | SVCConfigurationPreset; } /** * The error code of the media stream relay. You can get the code through [AgoraRTCClient.on("channel-media-relay-state")]{@link IAgoraRTCClient.event_channel_media_relay_state}. */ export declare enum ChannelMediaRelayError { /** * No error. */ RELAY_OK = "RELAY_OK", /** * The SDK disconnects from the relay service. */ SERVER_CONNECTION_LOST = "SERVER_CONNECTION_LOST", /** * The token of the source channel has expired. */ SRC_TOKEN_EXPIRED = "SRC_TOKEN_EXPIRED", /** * The token of the destination channel has expired. */ DEST_TOKEN_EXPIRED = "DEST_TOKEN_EXPIRED" } /** * Events during the media stream relay. You can get the event through [AgoraRTCClient.on("channel-media-relay-event")]{@link IAgoraRTCClient.event_channel_media_relay_event}. */ export declare enum ChannelMediaRelayEvent { /** * The user disconnects from the server due to a poor network connection. */ NETWORK_DISCONNECTED = "NETWORK_DISCONNECTED", /** * The user is connected to the server. */ NETWORK_CONNECTED = "NETWORK_CONNECTED", /** * The user joins the source channel. */ PACKET_JOINED_SRC_CHANNEL = "PACKET_JOINED_SRC_CHANNEL", /** * The user joins the destination channel. */ PACKET_JOINED_DEST_CHANNEL = "PACKET_JOINED_DEST_CHANNEL", /** * The SDK starts relaying the media stream to the destination channel. */ PACKET_SENT_TO_DEST_CHANNEL = "PACKET_SENT_TO_DEST_CHANNEL", /** * The server receives the video stream from the source channel. */ PACKET_RECEIVED_VIDEO_FROM_SRC = "PACKET_RECEIVED_VIDEO_FROM_SRC", /** * The server receives the audio stream from the source channel. */ PACKET_RECEIVED_AUDIO_FROM_SRC = "PACKET_RECEIVED_AUDIO_FROM_SRC", /** * The destination channel is updated. */ PACKET_UPDATE_DEST_CHANNEL = "PACKET_UPDATE_DEST_CHANNEL", /** * Fails to update the destination channel due to an internal error. */ PACKET_UPDATE_DEST_CHANNEL_REFUSED = "PACKET_UPDATE_DEST_CHANNEL_REFUSED", /** * The destination channel is not updated. */ PACKET_UPDATE_DEST_CHANNEL_NOT_CHANGE = "PACKET_UPDATE_DEST_CHANNEL_NOT_CHANGE" } /** * Channel information in the media relay, used in [ChannelMediaRelayConfiguration]{@link IChannelMediaRelayConfiguration}. */ export declare interface ChannelMediaRelayInfo { /** * The channel name. */ channelName: string; /** * The token generated with the `channelName` and `uid`. Do not set this parameter if you have not enabled token. * The token for authentication. Do not set this parameter if you have not enabled token authentication. * * - When you set the information of the source channel, the token is generated with 0 and the source channel name. * - When you set the information of the destination channel, the token is generated with `uid` and the destination channel name. */ token?: string; /** * The unique ID to identify the relay stream. * * A 32-bit unsigned integer with a value ranging from 0 to (2<sup>32</sup>-1). If you set it as `0`, the server assigns a random one. * * When used for the source channel, it is the ID to identify the relay stream in the source channel. * * When used for the destination channel, it is the ID to identify the relay stream in the destination channel. To avoid UID conflicts, this value must be different from any other user IDs in the destination channel. * - When you set the information of the source channel, set `uid` as the ID of the host whose stream is relayed. * - When you set the information of the destination channel, you can set `uid` as `0` (the server assigns a random one) or a 32-bit unsigned integer with a value ranging from 0 to (2<sup>32</sup>-1). To avoid UID conflicts, this value must be different from any other user IDs in the destination channel. */ uid: number; } /** * The state code of the media stream relay. You can get the code through [AgoraRTCClient.on("channel-media-relay-state")]{@link IAgoraRTCClient.event_channel_media_relay_state}. */ export declare enum ChannelMediaRelayState { /** * The SDK is initialized, but has not started the media stream relay service. */ RELAY_STATE_IDLE = "RELAY_STATE_IDLE", /** * The SDK is connecting to the media stream relay service. */ RELAY_STATE_CONNECTING = "RELAY_STATE_CONNECTING", /** * The SDK successfully relays the media stream to the destination channel. */ RELAY_STATE_RUNNING = "RELAY_STATE_RUNNING", /** * An error occurs in the media stream relay. See {@link ChannelMediaRelayError} for the error code. */ RELAY_STATE_FAILURE = "RELAY_STATE_FAILURE" } /** * The visibility of the `<video>` tag. * * Get the visibility of the `<video>` tag through the following methods and events: * - [localVideoTrack.on("video-element-visible-status")]{@link ILocalVideoTrack.event_video_element_visible_status} * - [localVideoTrack.getVideoElementVisibleStatus]{@link ILocalVideoTrack.getVideoElementVisibleStatus} * - [remoteVideoTrack.on("video-element-visible-status")]{@link IRemoteVideoTrack.event_video_element_visible_status_2} * - [remoteVideoTrack.getVideoElementVisibleStatus]{@link IRemoteVideoTrack.getVideoElementVisibleStatus} * * This object contains the following parameters: * - `visible`: Boolean, whether the `<video>` tag is visible or not. * - `reason`: This parameter is only valid when `visible` is `false`, which indicates the reason: * - `"SIZE"`: The size of `<video>` is too small to see. * - `"STYLE"`: The CSS styles of `<video>` or its ancestor element cause `<video>` to be invisible. * - `"POSITION"`: The `<video>` tag or its ancestor element are positioned outside the viewport. * - `"COVERED"`: The `<video>` tag is covered by other elements. */ declare type CheckVideoVisibleResult = CheckVisibleResult; /** * @ignore */ declare type CheckVisibleResult = VisibleResultInner | VisibleHiddenResult; /** * Interface for defining the behavior of a web client. * * You need to configure it when calling the {@link createClient} method to create a web client. * * > The [mode]{@link ClientConfig.mode} and [codec]{@link ClientConfig.codec} properties are required. */ export declare interface ClientConfig { /** * The codec that the Web browser uses for encoding. * - `"vp8"`: Use VP8 for encoding. * - `"h264"`: Use H.264 for encoding. * - `"vp9"`: (Beta) Use VP9 for encoding. * - `"av1"`: (Beta) Use AV1 for encoding. * * > Safari 12.1 or earlier does not support the VP8 codec. */ codec: SDK_CODEC; /** * @ignore */ audioCodec?: SDK_AUDIO_CODEC; /** * The channel profile. * * The SDK differentiates channel profiles and applies different optimization algorithms accordingly. For example, it prioritizes smoothness and low latency for a video call, and prioritizes video quality for a video streaming. * * The SDK supports the following channel profiles: * - `"live"`: Sets the channel profile as live streaming. You need to go on to call [setClientRole]{@link IAgoraRTCClient.setClientRole} to set the client as either a host or an audience. A host can send and receive audio or video, while an audience can only receive audio or video. * - `"rtc"`: Sets the channel profile as communication. It is used for a one-on-one call or a group call where all users in the channel can converse freely. */ mode: SDK_MODE; /** * The user role in a live interactive streaming (when [mode]{@link ClientConfig.mode} is `"live"`). * * The user role determines the permissions that the SDK grants to a user, such as permission to publish local streams, subscribe to remote streams, and push streams to a CDN address. You can set the user role as `"host"` or `"audience"`. A host can publish and subscribe to tracks, while an audience member can only subscribe to tracks. The default role in a live streaming is `"audience"`. Before publishing tracks, you must set the user role as `"host"`. * * After creating a client, you can call {@link setClientRole} to switch the user role. */ role?: ClientRole; /** * The detailed options of the user role, including user level. * * The user level determines the level of services that a user can enjoy within the permissions of the user's role. For example, an audience can choose to receive remote streams with low latency or ultra low latency. Levels affect prices. */ clientRoleOptions?: ClientRoleOptions; /** * @ignore */ proxyServer?: string; /** * @ignore */ turnServer?: TurnServerConfig; /** * @ignore */ httpRetryConfig?: RetryConfiguration; /** * @ignore */ websocketRetryConfig?: RetryConfiguration; } /** * The user role in a live broadcast channel. * - `"host"`: Host. A host can both publish tracks and subscribe to tracks. * - `"audience"`: Audience. An audience can only subscribe to tracks. */ export declare type ClientRole = "audience" | "host"; export declare interface ClientRoleOptions { /** * The latency level of an audience member in a live interactive streaming. * * > Note: * > - Takes effect only when the user role is `"audience"`. * > - Levels affect prices. */ level: AudienceLatencyLevelType; /** * @ignore */ delay?: number; } /** * Reason for the disconnection. */ export declare enum ConnectionDisconnectedReason { /** * The user has left the channel. */ LEAVE = "LEAVE", /** * The network is down, and cannot recover after retry. */ NETWORK_ERROR = "NETWORK_ERROR", /** * The server returns an error. This is usually caused by incorrect parameter settings. */ SERVER_ERROR = "SERVER_ERROR", /** * The user is banned. */ UID_BANNED = "UID_BANNED", /** * @ignore */ FALLBACK = "FALLBACK", /** * The IP is banned. */ IP_BANNED = "IP_BANNED", /** * The channel is banned. */ CHANNEL_BANNED = "CHANNEL_BANNED", /** * @ignore */ LICENSE_MISSING = "LICENSE_MISSING", /** * @ignore */ LICENSE_EXPIRED = "LICENSE_EXPIRED", /** * @ignore */ LICENSE_MINUTES_EXCEEDED = "LICENSE_MINUTES_EXCEEDED", /** * @ignore */ LICENSE_PERIOD_INVALID = "LICENSE_PERIOD_INVALID", /** * @ignore */ LICENSE_MULTIPLE_SDK_SERVICE = "LICENSE_MULTIPLE_SDK_SERVICE", /** * @ignore */ LICENSE_ILLEGAL = "LICENSE_ILLEGAL", /** * The user's token expires. */ TOKEN_EXPIRE = "TOKEN_EXPIRE" } /** * Connection state between the SDK and Agora's edge server. * * You can get the connection state through [connectionState]{@link IAgoraRTCClient.connectionState}. * * The connection between the SDK and the edge server has the following states: * - `"DISCONNECTED"`: The SDK is disconnected from the server. * - This is the initial state until you call [join]{@link IAgoraRTCClient.join}. * - The SDK also enters this state after you call [leave]{@link IAgoraRTCClient.leave}, when the user is banned, or when the connection fails. * - `"CONNECTING"`: The SDK is connecting to the server. The SDK enters this state when you call [join]{@link IAgoraRTCClient.join}. * - `"CONNECTED"`: The SDK is connected to the server and joins a channel. The user can now publish streams or subscribe to streams in the channel. * - `"RECONNECTING"`: The SDK is reconnecting to the server. If the connection is lost because the network is down or switched, the SDK enters this state. * - `"DISCONNECTING"`: The SDK is disconnecting from the server. The SDK enters this state when you call [leave]{@link IAgoraRTCClient.leave}. */ export declare type ConnectionState = "DISCONNECTED" | "CONNECTING" | "RECONNECTING" | "CONNECTED" | "DISCONNECTING"; /** * Specifies a constraint for a property, such as the resolution or bitrate for video capture in [[VideoEncoderConfiguration]]. */ export declare interface ConstrainLong { /** * The lower limit of the property. */ min?: number; /** * The upper limit of the property. */ max?: number; /** * An ideal value of a property. If the video capture device cannot output this value, it outputs the closest value instead. */ ideal?: number; /** * A required value of a property. If the video capture device cannot output this value, the video capture fails. */ exact?: number; } /** * Configurations for the custom audio track. Set these configurations when calling [AgoraRTC.createCustomAudioTrack]{@link IAgoraRTC.createCustomAudioTrack}. */ export declare interface CustomAudioTrackInitConfig { /** * Your [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack) object. */ mediaStreamTrack: MediaStreamTrack; /** * The audio encoder configurations. * * You can set the audio encoder configurations in either of the following ways: * - Pass the preset audio encoder configurations by using [[AudioEncoderConfigurationPreset]]. * - Pass your customized audio encoder configurations by using [[AudioEncoderConfiguration]]. * * > Firefox does not support setting the audio encoding rate. */ encoderConfig?: AudioEncoderConfiguration | AudioEncoderConfigurationPreset; } /** * Configurations for the custom video track. Set these configurations when calling [AgoraRTC.createCustomVideoTrack]{@link IAgoraRTC.createCustomVideoTrack}. */ export declare interface CustomVideoTrackInitConfig { /** * Your [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack) object. */ mediaStreamTrack: MediaStreamTrack; /** * @since * <br>&emsp;&emsp;&emsp;*4.17.1* * * Width of the video. * * You can pass a `number`, or a constraint such as `{ max: 1280, min: 720 }`. * * For more details about the constraint, see [ConstrainLong]{@link ConstrainLong}. */ width?: number | ConstrainLong; /** * @since * <br>&emsp;&emsp;&emsp;*4.17.1* * * Height of the video. * * You can pass a `number`, or a constraint such as `{ max: 1280, min: 720 }`. * * For more details about the constraint, see [ConstrainLong]{@link ConstrainLong}. */ height?: number | ConstrainLong; /** * @since * <br>&emsp;&emsp;&emsp;*4.17.1* * * Frame rate of the video (fps). * * You can pass a `number`, or a constraint such as `{ max: 30, min: 5 }`. * * For details about the constraint, see [ConstrainLong]{@link ConstrainLong}. */ frameRate?: number | ConstrainLong; /** * The minimum bitrate of sending the video track (Kbps). */ bitrateMin?: number; /** * The maximum bitrate of sending the video track (Kbps). */ bitrateMax?: number; /** * @since * <br>&emsp;&emsp;&emsp;*4.2.0* * * Sets the video transmission optimization mode. * * You can call this method during a video call, a live streaming or screen sharing to dynamically change the optimization mode. For example, during the screen sharing, before you change the shared content from text to video, you can change the optimization mode from `"detail"` to `"motion"` to ensure smoothness in poor network conditions. * * > Note: This method supports Chrome only. * * @param mode The video transmission optimization mode: * - `"balanced"`: Uses the default optimization mode. * - For a screen-sharing video track, the default transmission optimization strategy is to prioritizes clarity. * - For the other types of video tracks, the SDK may reduce the frame rate or the sending resolution in poor network conditions. * - `"detail"`: Prioritizes video quality. * - The SDK ensures high-quality images by automatically calculating a minimum bitrate based on the capturing resolution and frame rate. No matter how poor the network condition is, the sending bitrate will never be lower than the minimum value. * - In most cases, the SDK does not reduce the sending resolution, but may reduce the frame rate. * - `"motion"`: Since 4.21.0, the SDK prioritizes video smoothness. * - In poor network conditions, the SDK reduces the sending bitrate to minimize video freezes. * - In most cases, the SDK does not reduce the frame rate, but may reduce the sending resolution. */ optimizationMode?: OptimizationMode; /** * @ignore * * @since * <br>&emsp;&emsp;&emsp;*4.18.0* * * Configurations for Scalable Video Coding (SVC). * * You can set `scalabiltyMode` using one of the following options: * - Use the preset SVC configurations provided by the SDK through {@link SVCConfigurationPreset}. * - Use your custom SVC configurations through {@link SVCConfiguration}. */ scalabiltyMode?: SVCConfiguration | SVCConfigurationPreset; } /** * Information of the media input device. * * - You can get the audio sampling device information through [onMicrophoneChanged]{@link onMicrophoneChanged}. * - You can get the video capture device information through [onCameraChanged]{@link onCameraChanged}. * - You can get the audio playback device information through [onPlaybackDeviceChanged]{@link onPlaybackDeviceChanged}. */ export declare interface DeviceInfo { /** * The latest time when the state of the media input device was updated. * * A Unix timestamp in milliseconds. */ updateAt: number; /** * The time when the SDK first detects the media input device. * * A Unix timestamp in milliseconds. */ initAt: number; /** * The state of the capture device. */ state: DeviceState; /** * Device information of the media input device. See [MediaDeviceInfo](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo) for details. */ device: MediaDeviceInfo; } /** * The state of the media input device. * - `"ACTIVE"`: The device is plugged in. * - `"INACTIVE"`: The device is unplugged. */ export declare type DeviceState = "ACTIVE" | "INACTIVE"; /** * Information of the sharing screen source on Electron, which is retrieved by calling {@link getElectronScreenSources}. * * See [DesktopCapturerSource](https://www.electronjs.org/docs/api/structures/desktop-capturer-source) in the Electron API documentation for details. */ export declare interface ElectronDesktopCapturerSource { /** * The ID of the screen source. */ id: string; /** * The name of the screen source. */ name: string; /** * The thumbnail of the screen source. * * See [ElectronNativeImage](https://electronjs.org/docs/api/native-image#nativeimage) for details. */ thumbnail: IElectronNativeImage; } /** * The encryption mode, which is used in the {@link setEncryptionConfig} method call. * - `"aes-128-xts"`: 128-bit AES encryption, XTS mode. * - `"aes-256-xts"`: 256-bit AES encryption, XTS mode. * - `"aes-128-gcm"`: 128-bit AES encryption, GCM mode. * - `"aes-256-gcm"`: 256-bit AES encryption, GCM mode. * - `"aes-128-gcm2"`: 128-bit AES encryption, GCM mode, with salt. * - `"aes-256-gcm2"`: 256-bit AES encryption, GCM mode, with salt. * - `"aes-128-ecb"`: 128-bit AES encryption, ECB mode. * - `"sm4-128-ecb"`: 128-bit SM4 encryption, ECB mode. * - `"none"`: No encryption. */ export declare type EncryptionMode = "aes-128-xts" | "aes-256-xts" | "aes-128-ecb" | "sm4-128-ecb" | "aes-128-gcm" | "aes-256-gcm" | "aes-128-gcm2" | "aes-256-gcm2" | "none"; /** * @since * <br>&emsp;&emsp;&emsp;*4.20.0* * * Callback for changes in the [Audio Context](https://developer.mozilla.org/en-US/docs/Web/API/AudioContext) state. The `"interrupted"` state in this callback is currently only triggered on iOS devices. * * @param currState The current state, with possible values: * - `AudioContextState`: Enumerated values are detailed in [BaseAudioContext.state](https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/state). * - `"interrupted"`: Audio and video playback is interrupted by a system phone call or another app. You call the {@link resumeAudioContext} method to resume audio and video playback. * @param prevState The previous state, with possible values: * - `AudioContextState`: Enumerated values are detailed in [BaseAudioContext.state](https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/state). * - `"interrupted"`: Audio and video playback is interrupted by a system phone call or another app. * - `undefined`: No previous state. * * @asMemberOf IAgoraRTC * @event */ declare function event_audio_context_state_changed(currState: AudioContextState | "interrupted", prevState: AudioContextState | "interrupted" | undefined): void; /** * @since * <br>&emsp;&emsp;&emsp;*4.18.0* * * If you needs a more flexible way of listening to autoplay failures, Agora recommends that you call {@link IAgoraRTC.on} and pass in this callback to replace {@link onAutoplayFailed}. * * ```javascript * AgoraRTC.on("autoplay-failed", (info) => { * console.log("Autoplay failed!", info.state, info.device); * }); * ``` * * @asMemberOf IAgoraRTC * @event */ declare function event_autoplay_failed(): void; /** * @ignore * * Occurs when the device is overloaded after you call [setBeautyEffect]{@link ILocalVideoTrack.setBeautyEffect} to enable image enhancement. * * You can listen for this event to notify users of the device overload and disable image enhancement. * * ```javascript * localVideoTrack.on("beauty-effect-overload", () => { * console.log("beauty effect overload, disable beauty effect"); * localVideoTrack.setBeautyEffect(false); * }); * ``` * @event * @asMemberOf ILocalVideoTrack */ declare function event_beauty_effect_overload(): void; /** * @since * <br>&emsp;&emsp;&emsp;*4.18.0* * * If you needs a more flexible way of listening to camera device changes, Agora recommends that you call {@link IAgoraRTC.on} and pass in this callback to replace {@link onCameraChanged}. * * ```javascript * AgoraRTC.on("camera-changed", (info) => { * console.log("Camera changed!", info.state, info.device); * }); * ``` * * @param deviceInfo The device information. See {@link DeviceInfo}. * @asMemberOf IAgoraRTC * @event */ declare function event_camera_changed(deviceInfo: DeviceInfo): void; /** * Reports events during a media stream relay. * * @param event The event code for a media stream relay. * @asMemberOf IAgoraRTCClient * @event */ declare function event_channel_media_relay_event(event: ChannelMediaRelayEvent): void; /** * Occurs when the state of the media stream relay changes. * * The SDK reports the state and error code of the current media relay with this callback. * * If the media relay is in an abnormal state, you can find the error code in {@link ChannelMediaRelayError} (for example if the token has expired, or repeated reconnection attempts fail.) * @param state The state of the media relay. * @param code The error code. * @asMemberOf IAgoraRTCClient * @event */ declare function event_channel_media_relay_state(state: ChannelMediaRelayState, code: ChannelMediaRelayError): void; /** * Occurs when the state of the connection between the SDK and the server changes. * @param curState The current connection state. * @param revState The previous connection state. * @param reason The reason of disconnection if `curState` is `"DISCONNECTED"`. * @asMemberOf IAgoraRTCClient * @event */ declare function event_connection_state_change(curState: ConnectionState, revState: ConnectionState, reason?: ConnectionDisconnectedReason): void; declare function event_content_inspect_connection_state_change(preState: InspectState, newState: InspectState): void; declare function event_content_inspect_error(error?: AgoraRTCError): void; /** * Occurs when decryption fails. * * The SDK triggers this callback when the decryption fails during the process of subscribing to a stream. The failure is usually caused by incorrect encryption settings. See {@link setEncryptionConfig} for details. * @asMemberOf IAgoraRTCClient * @event */ declare function event_crypt_error(): void; /** * Reports exceptions in the channel. * * Exceptions are not errors, but usually reflect quality issues. * * This callback also reports recovery from an exception. * * Each exception corresponds to a recovery event. * * **Exception** * * | Code | Message | Exception | * | :----- | :------------------------- | :--------------- | * | 1001 | FRAMERATE_INPUT_TOO_LOW | Captured video frame rate is too low | * | 1002 | FRAMERATE_SENT_TOO_LOW | Sent video frame rate is too low | * | 1003 | SEND_VIDEO_BITRATE_TOO_LOW | Sent video bitrate is too low | * | 1005 | RECV_VIDEO_DECODE_FAILED | Decoding received video fails | * | 2001 | AUDIO_INPUT_LEVEL_TOO_LOW | Sent audio volume is too low | * | 2002 | AUDIO_OUTPUT_LEVEL_TOO_LOW | Received audio volume is too low | * | 2003 | SEND_AUDIO_BITRATE_TOO_LOW | Sent audio bitrate is too low | * | 2005 | RECV_AUDIO_DECODE_FAILED | Decoding received audio fails | * * **Recoveries** * * | Code | Message | Recovery | * | :----- | :------------------------- | :--------------- | * |3001 | FRAMERATE_INPUT_TOO_LOW_RECOVER | Captured video frame rate recovers | * |3002 | FRAMERATE_SENT_TOO_LOW_RECOVER | Sent video frame rate recovers | * |3003 | SEND_VIDEO_BITRATE_TOO_LOW_RECOVER | Sent video bitrate recovers | * |3005 | RECV_VIDEO_DECODE_FAILED_RECOVER | Decoding received video recovers | * |4001 | AUDIO_INPUT_LEVEL_TOO_LOW_RECOVER | Sent audio volume recovers | * |4002 | AUDIO_OUTPUT_LEVEL_TOO_LOW_RECOVER | Received audio volume recovers | * |4003 | SEND_AUDIO_BITRATE_TOO_LOW_RECOVER | Sent audio bitrate recovers | * |4005 | RECV_AUDIO_DECODE_FAILED_RECOVER | Decoding received audio recovers | * * @asMemberOf IAgoraRTCClient * @event */ declare function event_exception(event: { /** * The event code. */ code: number; /** * The event message. */ msg: string; /** * The ID of the user who has experienced the exception or recovery event. */ uid: UID; }): void; /** * Occurs when the first remote audio or video frame is decoded. * * > Note: * > To trigger this callback, the local client needs to call [IRemoteTrack.play]{@link play}. * * @event * @asMemberOf IRemoteTrack */ declare function event_first_frame_decoded(): void; declare function event_image_moderation_connection_state_change(newState: ImageModerationConnectionState, preState: ImageModerationConnectionState): void; /** * @since * <br>&emsp;&emsp;&emsp;*4.4.0* * * The SDK triggers this callback to indicate whether the media stream is forwarded by the Agora cloud proxy service. * - Earlier than v4.10.0: The callback is triggered after the method call of [[publish]] succeeds. * - v4.10.0 and later: The callback is triggered after the method call of [[join]] succeeds. * * @param isUsingProxy Whether the media stream is forwarded by the Agora cloud proxy service. * - `true`: Forwarded by the Agora cloud proxy service. * - `false`: Not forwarded by the Agora cloud proxy service. * @asMemberOf IAgoraRTCClient * @event */ declare function event_is_using_cloud_proxy(isUsingProxy: boolean): void; /** * @deprecated from v4.19.0. This callback will not be triggered because the SDK stops using proxy to ensure connectivity. * * Occurs when the SDK automatically switches to TCP/TLS 443. * * As of v4.11.0, if the SDK fails in the attempt to directly connect to Agora SD-RTN™ after you call [[join]], * the SDK automatically switches to TCP/TLS 443 in order to ensure connectivity. * * @param proxyServer The server address used after the switch. * @asMemberOf IAgoraRTCClient * @event */ de