jiuyiUniapp/jiuyi2/node_modules/agora-rtc-sdk-ng/rtc-sdk_cn.d.ts

5909 lines
244 KiB
TypeScript
Raw Normal View History

2024-12-18 15:46:27 +08:00
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;
}
/**
* AgoraSDK Code
* @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",
/** P2P信令交互过程中出现异常 */
EXCHANGE_SDP_FAILED = "EXCHANGE_SDP_FAILED",
/** P2P添加候选人过程中出现异常 */
ADD_CANDIDATE_FAILED = "ADD_CANDIDATE_FAILED",
/** DataChannel交互过程中出现异常 */
DATACHANNEL_FAILED = "DATACHANNEL_FAILED",
/**
* http post
*/
NETWORK_ERROR = "NETWORK_ERROR",
NETWORK_TIMEOUT = "NETWORK_TIMEOUT",
NETWORK_RESPONSE_ERROR = "NETWORK_RESPONSE_ERROR",
/**
* report
*/
API_INVOKE_TIMEOUT = "API_INVOKE_TIMEOUT",
/**
* Device
*/
/** 枚举本地设备失败 */
ENUMERATE_DEVICES_FAILED = "ENUMERATE_DEVICES_FAILED",
/** 找不到指定设备 */
DEVICE_NOT_FOUND = "DEVICE_NOT_FOUND",
/**
* Electron
*/
/** 无法获取 Electron 对象 */
ELECTRON_IS_NULL = "ELECTRON_IS_NULL",
/** 无法通过 Electron 获取屏幕共享源 */
ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR = "ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR",
/**
* Stream
*/
/** init 因为其他的 init 操作而中止 */
/** chrome 屏幕共享插件没有响应 */
CHROME_PLUGIN_NO_RESPONSE = "CHROME_PLUGIN_NO_RESPONSE",
/** chrome 屏幕共享插件没有安装 */
CHROME_PLUGIN_NOT_INSTALL = "CHROME_PLUGIN_NOT_INSTALL",
/** 媒体采集的参数不支持 */
MEDIA_OPTION_INVALID = "MEDIA_OPTION_INVALID",
/** 获取媒体设备权限被拒绝 */
PERMISSION_DENIED = "PERMISSION_DENIED",
/** 浏览器不支持该 constraint */
CONSTRAINT_NOT_SATISFIED = "CONSTRAINT_NOT_SATISFIED",
/** 播放时被浏览器自动播放策略阻止 */
/** 创建小流时检测到大流没有视频轨 */
/** 屏幕共享不允许使用大小流 */
/** 轨道被禁用 */
TRACK_IS_DISABLED = "TRACK_IS_DISABLED",
/** 获取 video element 可见状态失败*/
GET_VIDEO_ELEMENT_VISIBLE_ERROR = "GET_VIDEO_ELEMENT_VISIBLE_ERROR",
/** 屏幕共享音频时用户没有点击 **分享音频** */
SHARE_AUDIO_NOT_ALLOWED = "SHARE_AUDIO_NOT_ALLOWED",
/** 使用RTCRtpEncodingParameters 进行小流编码失败*/
LOW_STREAM_ENCODING_ERROR = "LOW_STREAM_ENCODING_ERROR",
/** 设置 rtp encoding parameters 失败 */
SET_ENCODING_PARAMETER_ERROR = "SET_ENCODING_PARAMETER_ERROR",
/** Track 状态不可达 */
TRACK_STATE_UNREACHABLE = "TRACK_STATE_UNREACHABLE",
/**
* Client join
*/
/** 用户提供的 Token 生成函数运行时出现错误 */
/** 通过 string uid allocate 服务返回了非法的 int uid */
INVALID_UINT_UID_FROM_STRING_UID = "INVALID_UINT_UID_FROM_STRING_UID",
/** 尝试了数次均无法获取云代理服务 */
CAN_NOT_GET_PROXY_SERVER = "CAN_NOT_GET_PROXY_SERVER",
/** 尝试了数次均无法获取 gateway 地址 */
CAN_NOT_GET_GATEWAY_SERVER = "CAN_NOT_GET_GATEWAY_SERVER",
/** 从 AP 拿到的网关列表为空 (obsolete after 4.7.0)*/
VOID_GATEWAY_ADDRESS = "VOID_GATEWAY_ADDRESS",
/** UID 冲突,重复的 UID */
UID_CONFLICT = "UID_CONFLICT",
/** multi unilbs 服务,响应解析错误 */
MULTI_UNILBS_RESPONSE_ERROR = "MULTI_UNILBS_RESPONSE_ERROR",
/** 更新 Ticket 请求失败 */
UPDATE_TICKET_FAILED = "UPDATE_TICKET_FAILED",
/**
* Client publish/unpublish
*/
/** 传入了非法的 local track */
INVALID_LOCAL_TRACK = "INVALID_LOCAL_TRACK",
/** 传入了非法的 track */
INVALID_TRACK = "INVALID_TRACK",
/** replaceTrack 等操作时找不到指定的 sender */
SENDER_NOT_FOUND = "SENDER_NOT_FOUND",
/** p2p 建立相关 */
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",
/** 获取本地RTP能力失败 */
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",
/** 网关抛出的 P2P 断开 */
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",
/**
* Client subscribe/unsubscribe
*/
/** 找不到指定的订阅用户 */
INVALID_REMOTE_USER = "INVALID_REMOTE_USER",
/** 远端用户没有发布 */
REMOTE_USER_IS_NOT_PUBLISHED = "REMOTE_USER_IS_NOT_PUBLISHED",
/** 相同流的上一个订阅还没有完成 */
/**
* Client
*/
/** 自定义事件上报失败,通常是因为网络原因 */
CUSTOM_REPORT_SEND_FAILED = "CUSTOM_REPORT_SEND_FAILED",
/** 自定义上报太频繁 */
CUSTOM_REPORT_FREQUENCY_TOO_HIGH = "CUSTOM_REPORT_FREQUENCY_TOO_HIGH",
/**
* Stream
*/
/** 下载在线音频文件失败 */
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",
/** 音效的 `soundID` 发生冲突 */
/** 找不到指定的音效 ID */
/**
* Gateway
*/
/** 请求网关时 WS 断开 */
WS_ABORT = "WS_ABORT",
/** 请求网关前网关就已经断开 */
WS_DISCONNECT = "WS_DISCONNECT",
WS_ERR = "WS_ERR",
/** p2p 拓展通道断开 */
EXTERNAL_SIGNAL_ABORT = "EXTERNAL_SIGNAL_ABORT",
/**
* Live Streaming
*/
/** 无法和推流后台建立连接 */
/** 推流任务已经存在 */
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",
/** 推流 URL 被占用 */
LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED = "LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED",
/** 在非转码推流中调用了转码参数 */
LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED = "LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED",
/** 推流的目标 CDN 出现错误导致推流失败 */
LIVE_STREAMING_CDN_ERROR = "LIVE_STREAMING_CDN_ERROR",
/** 推流超时,请确认目标流是否存在 */
LIVE_STREAMING_INVALID_RAW_STREAM = "LIVE_STREAMING_INVALID_RAW_STREAM",
/** 推流超过 10 路流 */
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/
*/
/** WebGL 内部错误 */
WEBGL_INTERNAL_ERROR = "WEBGL_INTERNAL_ERROR",
/** 美颜内部错误 */
BEAUTY_PROCESSOR_INTERNAL_ERROR = "BEAUTY_PROCESSOR_INTERNAL_ERROR",
/**
* Cross Channel
*/
/** 等待 status 回调出错 */
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",
/**
* AVC SEI
*/
/** 需要编码的 SEI 数据超过了最大大小 */
METADATA_OUT_OF_RANGE = "METADATA_OUT_OF_RANGE",
LOCAL_AEC_ERROR = "LOCAL_AEC_ERROR",
/** 插件不合法 */
INVALID_PLUGIN = "INVALID_PLUGIN",
/** 抛出断开P2P的错误来让未执行完成的P2P操作结束*/
DISCONNECT_P2P = "DISCONNECT_P2P",
/** imageData转换为Blob时失败 */
CONVERTING_IMAGEDATA_TO_BLOB_FAILED = "CONVERTING_IMAGEDATA_TO_BLOB_FAILED",
CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED = "CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED",
/** datachannel相关 */
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 datastream传输消息失败 */
P2P_MESSAGE_FAILED = "P2P_MESSAGE_FAILED"
}
/**
* [AgoraRTCClient.getRTCStats]{@link IAgoraRTCClient.getRTCStats}
* @public
*/
export declare interface AgoraRTCStats {
/**
*
*/
Duration: number;
/**
* bps
*/
RecvBitrate: number;
/**
*
*/
RecvBytes: number;
/**
* bps
*/
SendBitrate: number;
/**
*
*/
SendBytes: number;
/**
*
*
* + 1
*/
UserCount: number;
/**
* SDK RTT (Round-Trip Time) ms
*/
RTT: number;
/**
* Kbps
*/
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
}
/**
* 访 [AgoraRTC.setArea]{@link IAgoraRTC.setArea}
* @public
*/
export declare enum AREAS {
/**
*
*/
CHINA = "CHINA",
/**
*
*/
ASIA = "ASIA",
/**
*
*/
NORTH_AMERICA = "NORTH_AMERICA",
/**
*
*/
EUROPE = "EUROPE",
/**
*
*/
JAPAN = "JAPAN",
/**
*
*/
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",
/**
* @ignore
*/
EXTENSIONS = "EXTENSIONS"
}
/**
* `"audience"`
* - `1`:
* - `2`:
* @public
*/
export declare enum AudienceLatencyLevelType {
/**
*
*/
AUDIENCE_LEVEL_LOW_LATENCY = 1,
/**
*
*/
AUDIENCE_LEVEL_ULTRA_LOW_LATENCY = 2,
/**
* @ignore
*/
AUDIENCE_LEVEL_SYNC_LATENCY = 3
}
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"
}
/**
*
*
*
*
* [AgoraRTC.createCustomAudioTrack]{@link IAgoraRTC.createCustomAudioTrack}
* [AgoraRTC.createMicrophoneAudioTrack]{@link IAgoraRTC.createMicrophoneAudioTrack}
* [AgoraRTC.createBufferSourceAudioTrack]{@link IAgoraRTC.createBufferSourceAudioTrack}
*/
export declare interface AudioEncoderConfiguration {
/**
* Hz
*/
sampleRate?: number;
/**
*
*/
sampleSize?: number;
/**
*
*/
stereo?: boolean;
/**
* Kbps
*/
bitrate?: number;
}
/**
* SDK [AudioEncoderConfiguration]{@link AudioEncoderConfiguration}
*
*
* - [AgoraRTC.createCustomAudioTrack]{@link IAgoraRTC.createCustomAudioTrack}
* - [AgoraRTC.createMicrophoneAudioTrack]{@link IAgoraRTC.createMicrophoneAudioTrack}
* - [AgoraRTC.createBufferSourceAudioTrack]{@link IAgoraRTC.createBufferSourceAudioTrack}
*
* SDK SDK 使 `"music_standard"`
*
* | | |
* | -------- | --------------- |
* |`"speech_low_quality"`|16 kHz 24 Kbps|
* |`"speech_standard"`|32 kHz 24 Kbps|
* |`"music_standard"`|48 kHz 32 Kbps|
* |`"standard_stereo"`|48 kHz 64 Kbps|
* |`"high_quality"`|48 kHz 128 Kbps|
* |`"high_quality_stereo"`|48 kHz 192 Kbps|
* @public
*/
export declare type AudioEncoderConfigurationPreset = keyof typeof AUDIO_ENCODER_CONFIG_SETTINGS;
/**
* [startProcessAudioBuffer]{@link IBufferSourceAudioTrack.startProcessAudioBuffer}
*/
export declare interface AudioSourceOptions {
/**
*
*/
cycle?: number;
/**
*
*/
loop?: boolean;
/**
*
*/
startPlayTime?: number;
}
/**
* [BufferSourceAudioTrack.on("source-state-change")]{@link IBufferSourceAudioTrack.event_source_state_change}
*
* - `"stopped"`:
* - `"playing"`:
* - `"paused"`:
* @public
*/
export declare type AudioSourceState = "stopped" | "playing" | "paused";
/**
* @ignore
*
* [setBeautyEffect]{@link ILocalVideoTrack.setBeautyEffect}
* @public
*/
export declare interface BeautyEffectOptions {
/**
*
*
* [0.0, 1.0] 0.0 0.5
*/
smoothnessLevel?: number;
/**
*
*
* [0.0, 1.0] 0.0 0.7
*/
lighteningLevel?: number;
/**
*
*
* [0.0, 1.0] 0.0 0.1
*/
rednessLevel?: number;
/**
* {@link lighteningLevel} 使
* - 0: 明暗对比弱
* - 1: ()
* - 2: 明暗对比强
*/
lighteningContrastLevel?: 0 | 1 | 2;
}
/**
* /线/`AudioBuffer` [AgoraRTC.createBufferSourceAudioTrack]{@link IAgoraRTC.createBufferSourceAudioTrack}
*/
export declare interface BufferSourceAudioTrackInitConfig {
/**
* 3
* - `File`: [File](https://developer.mozilla.org/en-US/docs/Web/API/File) 对象,表示一个本地文件。
* - `string`: 线 HTTPS 线(线 HTTPS CORS)
* - `AudioBuffer`: [AudioBuffer](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer) 对象表示 PCM 原始数据。
*/
source: File | string | AudioBuffer;
/**
* 线:
* - `true`: 线
* - `false`: 线
*/
cacheOnlineFile?: boolean;
/**
*
*
* [[AudioEncoderConfigurationPreset]] SDK [[AudioEncoderConfiguration]]
*
* > Firefox
*/
encoderConfig?: AudioEncoderConfiguration | AudioEncoderConfigurationPreset;
}
/**
* [AgoraRTC.createCameraVideoTrack]{@link IAgoraRTC.createCameraVideoTrack}
*/
export declare interface CameraVideoTrackInitConfig {
/**
*
*
*
* - [[VideoEncoderConfigurationPreset]] SDK
* - [[VideoEncoderConfiguration]]
* - 使 SDK `"480p_1"` 640 × 480 15 fps 500 Kbps
*/
encoderConfig?: VideoEncoderConfiguration | VideoEncoderConfigurationPreset;
/**
* 使/
*
* 使
* - `"user"`:
* - `"environment"`:
*/
facingMode?: VideoFacingModeEnum;
/**
* ID
*
* [AgoraRTC.getCameras]{@link IAgoraRTC.getCameras}
*/
cameraId?: string;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.2.0*
*
*
*
* 稿 `"detail"` `"motion"`
*
* > Chrome
*
* @param mode
* - `"detail"`:
* - SDK 使
* - SDK
* - `"motion"`: 4.21.0 SDK
* - SDK
* - SDK
*/
optimizationMode?: OptimizationMode;
/**
* @ignore
* @自从
* <br>&emsp;&emsp;&emsp;*4.18.0*
*
* SVC
*
* {@link SVCConfigurationPreset} SDK SVC {@link SVCConfiguration} SVC
*/
scalabiltyMode?: SVCConfiguration | SVCConfigurationPreset;
}
/**
* [AgoraRTCClient.on("channel-media-relay-state")]{@link IAgoraRTCClient.event_channel_media_relay_state}
* @public
*/
export declare enum ChannelMediaRelayError {
/**
*
*/
RELAY_OK = "RELAY_OK",
/**
*
*/
SERVER_CONNECTION_LOST = "SERVER_CONNECTION_LOST",
/**
* Token
*/
SRC_TOKEN_EXPIRED = "SRC_TOKEN_EXPIRED",
/**
* Token
*/
DEST_TOKEN_EXPIRED = "DEST_TOKEN_EXPIRED"
}
/**
* [AgoraRTCClient.on("channel-media-relay-event")]{@link IAgoraRTCClient.event_channel_media_relay_event}
* @public
*/
export declare enum ChannelMediaRelayEvent {
/**
*
*/
NETWORK_DISCONNECTED = "NETWORK_DISCONNECTED",
/**
*
*/
NETWORK_CONNECTED = "NETWORK_CONNECTED",
/**
*
*/
PACKET_JOINED_SRC_CHANNEL = "PACKET_JOINED_SRC_CHANNEL",
/**
*
*/
PACKET_JOINED_DEST_CHANNEL = "PACKET_JOINED_DEST_CHANNEL",
/**
* SDK
*/
PACKET_SENT_TO_DEST_CHANNEL = "PACKET_SENT_TO_DEST_CHANNEL",
/**
*
*/
PACKET_RECEIVED_VIDEO_FROM_SRC = "PACKET_RECEIVED_VIDEO_FROM_SRC",
/**
*
*/
PACKET_RECEIVED_AUDIO_FROM_SRC = "PACKET_RECEIVED_AUDIO_FROM_SRC",
/**
*
*/
PACKET_UPDATE_DEST_CHANNEL = "PACKET_UPDATE_DEST_CHANNEL",
/**
*
*/
PACKET_UPDATE_DEST_CHANNEL_REFUSED = "PACKET_UPDATE_DEST_CHANNEL_REFUSED",
/**
*
*/
PACKET_UPDATE_DEST_CHANNEL_NOT_CHANGE = "PACKET_UPDATE_DEST_CHANNEL_NOT_CHANGE"
}
/**
* [ChannelMediaRelayConfiguration]{@link IChannelMediaRelayConfiguration}
* @public
*/
export declare interface ChannelMediaRelayInfo {
/**
*
*/
channelName: string;
/**
* `uid` token token
* Token Token
*
* - 0 Token
* - `uid` Token
*/
token?: string;
/**
* UID
*
* 32 0 (2<sup>32</sup>-1) 0 UID
*
* UID
* - `uid` ID
* - `uid` 0 UID 32 0 (2<sup>32</sup>-1) ID
*
* UID ID
*/
uid: number;
}
/**
* [AgoraRTCClient.on("channel-media-relay-state")]{@link IAgoraRTCClient.event_channel_media_relay_state}
* @public
*/
export declare enum ChannelMediaRelayState {
/**
* SDK
*/
RELAY_STATE_IDLE = "RELAY_STATE_IDLE",
/**
* SDK
*/
RELAY_STATE_CONNECTING = "RELAY_STATE_CONNECTING",
/**
*
*/
RELAY_STATE_RUNNING = "RELAY_STATE_RUNNING",
/**
* {@link ChannelMediaRelayError}
*/
RELAY_STATE_FAILURE = "RELAY_STATE_FAILURE"
}
/**
* `<video>`
*
*
* - [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}
*
*
* - `visible`: Boolean `<video>`
* - `reason`: `visible` `false`
* - `"SIZE"`: `<video>` `<video>`
* - `"STYLE"`: `<video>` CSS `<video>`
* - `"POSITION"`: `<video>` `<video>`
* - `"COVERED"`: `<video>`
*/
declare type CheckVideoVisibleResult = CheckVisibleResult;
/**
* @ignore
*/
declare type CheckVisibleResult = VisibleResultInner | VisibleHiddenResult;
/**
*
*
* {@link createClient}
*
* > [mode]{@link ClientConfig.mode} [codec]{@link ClientConfig.codec}
* @public
*/
export declare interface ClientConfig {
/**
* 使
* - `"vp8"`: 使 VP8
* - `"h264"`: 使 H.264
* - `"vp9"`: (Beta) 使 VP9
* - `"av1"`: 使 AV1
*
* > Safari 12.1 VP8
*/
codec: SDK_CODEC;
/**
* @ignore
*/
audioCodec?: SDK_AUDIO_CODEC;
/**
*
*
* Agora Web SDK app 使使
*
* :
* - `"live"`: [setClientRole]{@link IAgoraRTCClient.setClientRole}
* - `"rtc"`:
*/
mode: SDK_MODE;
/**
* [mode]{@link ClientConfig.mode} `"live"`
*
* SDK CDN `"host"` `"audience"` {@link publish}
*
* {@link setClientRole}
*/
role?: ClientRole;
/**
*
*
*
*/
clientRoleOptions?: ClientRoleOptions;
/**
* @ignore
* HTTP
*
* Agora Web SDK [startProxyServer]{@link IAgoraRTCClient.startProxyServer} 使
*/
proxyServer?: string;
/**
* @ignore
* TURN
*
* Agora Web SDK [startProxyServer]{@link IAgoraRTCClient.startProxyServer} 使
*/
turnServer?: TurnServerConfig;
/**
* @ignore
* SDK HTTP/HTTPS
*
* [RetryConfiguration]{@link RetryConfiguration}
*/
httpRetryConfig?: RetryConfiguration;
/**
* @ignore
* SDK WebSocket
*
* [RetryConfiguration]{@link RetryConfiguration}
*/
websocketRetryConfig?: RetryConfiguration;
}
/**
*
* - `"host"`:
* - `"audience"`:
* @public
*/
export declare type ClientRole = "audience" | "host";
/**
*
*
* {@link ClientConfig.clientRoleOptions} [AgoraRTCClient.setClientRole]{@link IAgoraRTCClient.setClientRole}
* @public
*/
export declare interface ClientRoleOptions {
/**
*
*
* >
* > - `"audience"`
* > -
*/
level: AudienceLatencyLevelType;
/**
* @ignore
* , 0-3000ms
*/
delay?: number;
}
/**
*
*/
export declare enum ConnectionDisconnectedReason {
/** 用户正常退出。 */
LEAVE = "LEAVE",
/** 网络异常,经过重试后不可恢复。 */
NETWORK_ERROR = "NETWORK_ERROR",
/** 服务端返回出现异常,通常是因为集成过程中参数有误。 */
SERVER_ERROR = "SERVER_ERROR",
/** 当前用户被踢出。 */
UID_BANNED = "UID_BANNED",
/**
* @ignore
*/
FALLBACK = "FALLBACK",
/** 当前 IP 被踢出。 */
IP_BANNED = "IP_BANNED",
/** 当前频道被禁用。 */
CHANNEL_BANNED = "CHANNEL_BANNED",
/**
* @ignore
* license字段无上报
*/
LICENSE_MISSING = "LICENSE_MISSING",
/**
* @ignore
* license过期仍然登录
*/
LICENSE_EXPIRED = "LICENSE_EXPIRED",
/**
* @ignore
* license使用分钟数超过限制
*/
LICENSE_MINUTES_EXCEEDED = "LICENSE_MINUTES_EXCEEDED",
/**
* @ignore
* license使用时间段不合法
*/
LICENSE_PERIOD_INVALID = "LICENSE_PERIOD_INVALID",
/**
* @ignore
* license存在不同设备
*/
LICENSE_MULTIPLE_SDK_SERVICE = "LICENSE_MULTIPLE_SDK_SERVICE",
/**
* @ignore
* license不合法
*/
LICENSE_ILLEGAL = "LICENSE_ILLEGAL",
/**
* Token
*/
TOKEN_EXPIRE = "TOKEN_EXPIRE"
}
/**
* SDK [connectionState]{@link IAgoraRTCClient.connectionState}
*
* SDK 5 :
* - `"DISCONNECTED"`:
* - [join]{@link IAgoraRTCClient.join}
* - [leave]{@link IAgoraRTCClient.leave}
* -
* - `"CONNECTING"`: [join]{@link IAgoraRTCClient.join}
* - `"CONNECTED"`:
* - `"RECONNECTING"`: SDK SDK `"RECONNECTING"`
* - `"DISCONNECTING"`: [leave]{@link IAgoraRTCClient.leave}
* @public
*/
export declare type ConnectionState = "DISCONNECTED" | "CONNECTING" | "RECONNECTING" | "CONNECTED" | "DISCONNECTING";
/**
* [[VideoEncoderConfiguration]] /
*/
export declare interface ConstrainLong {
/**
*
*/
min?: number;
/**
*
*/
max?: number;
/**
*
*/
ideal?: number;
/**
*
*/
exact?: number;
}
/**
* [AgoraRTC.createCustomAudioTrack]{@link IAgoraRTC.createCustomAudioTrack}
*/
export declare interface CustomAudioTrackInitConfig {
/**
* [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack) 对象。
*/
mediaStreamTrack: MediaStreamTrack;
/**
*
*
* [[AudioEncoderConfigurationPreset]] SDK [[AudioEncoderConfiguration]]
*
* > Firefox
*/
encoderConfig?: AudioEncoderConfiguration | AudioEncoderConfigurationPreset;
}
/**
* [AgoraRTC.createCustomVideoTrack]{@link IAgoraRTC.createCustomVideoTrack}
*/
export declare interface CustomVideoTrackInitConfig {
/**
* [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack) 对象
*/
mediaStreamTrack: MediaStreamTrack;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.17.1*
*
*
*
* `number` `{ max: 1280, min: 720 }`
*
* [ConstrainLong]{@link ConstrainLong}
*/
width?: number | ConstrainLong;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.17.1*
*
*
*
* `number` `{ max: 1280, min: 720 }`
*
* [ConstrainLong]{@link ConstrainLong}
*/
height?: number | ConstrainLong;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.17.1*
*
* fps
*
* `number` `{ max: 30, min: 5 }`
*
* [ConstrainLong]{@link ConstrainLong}
*/
frameRate?: number | ConstrainLong;
/**
* Kbps
*/
bitrateMin?: number;
/**
* Kbps
*/
bitrateMax?: number;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.2.0*
*
*
*
* 稿 `"detail"` `"motion"`
*
* > Chrome
*
* @param mode
* - `"balanced"`: 使
* - SDK
* - SDK
* - `"detail"`:
* - SDK 使
* - SDK
* - `"motion"`: 4.21.0SDK
* - SDK
* - SDK
*/
optimizationMode?: "motion" | "detail";
/**
* @ignore
* @自从
* <br>&emsp;&emsp;&emsp;*4.18.0*
*
* SVC
*
* {@link SVCConfigurationPreset} SDK SVC {@link SVCConfiguration} SVC
*/
scalabiltyMode?: SVCConfiguration | SVCConfigurationPreset;
}
/**
*
*
* - [onMicrophoneChanged]{@link onMicrophoneChanged}
* - [onCameraChanged]{@link onCameraChanged}
* - [onPlaybackDeviceChanged]{@link onPlaybackDeviceChanged}
* @public
*/
export declare interface DeviceInfo {
/**
* UNIX ms
*/
updateAt: number;
/**
* SDK UNIX ms
*/
initAt: number;
/**
*
*/
state: DeviceState;
/**
* [MediaDeviceInfo](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo)。
*/
device: MediaDeviceInfo;
}
/**
*
* - `"ACTIVE"`:
* - `"INACTIVE"`:
* @public
*/
export declare type DeviceState = "ACTIVE" | "INACTIVE";
/**
* {@link getElectronScreenSources} Electron
*
* [Electron ](https://www.electronjs.org/docs/api/structures/desktop-capturer-source)。
* @public
*/
export declare interface ElectronDesktopCapturerSource {
/**
* Electron ID
*/
id: string;
/**
* Electron
*/
name: string;
/**
* Electron
*
* [ElectronNativeImage](http://electron.atom.io/docs/api/native-image)。
*/
thumbnail: IElectronNativeImage;
}
/**
* {@link setEncryptionConfig} 使
* - `"aes-128-xts"`: 128 AES XTS
* - `"aes-256-xts"`: 256 AES XTS
* - `"aes-128-gcm"`: 128 AES GCM
* - `"aes-256-gcm"`: 256 AES GCM
* - `"aes-128-gcm2"`: 128 AES GCM
* - `"aes-256-gcm2"`: 256 AES GCM
* - `"aes-128-ecb"`: 128 AES ECB
* - `"sm4-128-ecb"`: 128 SM4 ECB
* - `"none"`:
* @public
*/
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";
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.20.0*
*
* ([Audio Context](https://developer.mozilla.org/en-US/docs/Web/API/AudioContext)) 状态发生改变回调。该回调中的 `"interrupted"` 状态当前只会在 iOS 上触发。
*
* @param currState
* - `AudioContextState` [BaseAudioContext.state](https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/state)。
* - `"interrupted"`App {@link resumeAudioContext}
* @param prevState
* - `AudioContextState` [BaseAudioContext.state](https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/state)。
* - `"interrupted"`App
* - `undefined`
*
* @asMemberOf IAgoraRTC
* @event
*/
declare function event_audio_context_state_changed(currState: AudioContextState | "interrupted", prevState: AudioContextState | "interrupted" | undefined): void;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.18.0*
*
* {@link IAgoraRTC.on} {@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
*
* [setBeautyEffect]{@link ILocalVideoTrack.setBeautyEffect}
*
*
*
* ```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;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.18.0*
*
* {@link IAgoraRTC.on} {@link onCameraChanged}
*
* ```javascript
* AgoraRTC.on("camera-changed", (info) => {
* console.log("Camera changed!", info.state, info.device);
* });
* ```
*
* @param deviceInfo {@link DeviceInfo}
* @asMemberOf IAgoraRTC
* @event
*/
declare function event_camera_changed(deviceInfo: DeviceInfo): void;
/**
*
*
* @param event {@link ChannelMediaRelayEvent}
* @asMemberOf IAgoraRTCClient
* @event
*/
declare function event_channel_media_relay_event(event: ChannelMediaRelayEvent): void;
/**
*
*
* SDK
*
* {@link ChannelMediaRelayState} {@link ChannelMediaRelayError} token
* @param state
* @param code
* @asMemberOf IAgoraRTCClient
* @event
*/
declare function event_channel_media_relay_state(state: ChannelMediaRelayState, code: ChannelMediaRelayError): void;
/**
* SDK
*
* @param curState
* @param revState
* @param reason `curState` `"DISCONNECTED"`
* @asMemberOf IAgoraRTCClient
* @event
*/
declare function event_connection_state_change(curState: ConnectionState, revState: ConnectionState, reason?: ConnectionDisconnectedReason): void;
/**
*
*
*
* ```javascript
* client.on("content-inspect-connection-state-change", (preState, state) => {
* console.error(`Content Inspect Connection State Change: ${preState} -> ${state}` )
* })
* ```
*
* @param preState
* @param newState
*
* @asMemberOf IAgoraRTCClient
* @event
*/
declare function event_content_inspect_connection_state_change(preState: InspectState, newState: InspectState): void;
/**
*
*
*
* ```javascript
* client.on("content-inspect-error", error => {
* console.error("Content Inspect Error:", error)
* error.code === "OPERATION_ABORTED" && client.disableContentInspect()
* })
* ```
*
* @param error `AgoraRTCError`
* - code: 错误码
* - message: 错误消息
* - data:
*
*
*
* | | | |
* |:-----:|:----------|:-------------|
* |OPERATION_ABORTED|Content inspect was cancelled because it left the channel| |
*
*
* @asMemberOf IAgoraRTCClient
* @event
*/
declare function event_content_inspect_error(error?: AgoraRTCError): void;
/**
*
*
* {@link setEncryptionConfig}
* @asMemberOf IAgoraRTCClient
* @event
*/
declare function event_crypt_error(): void;
/**
* SDK
*
* SDK
*
*
*
*
*
* ****
*
* | | | |
* | :----- | :------------------------- | :--------------- |
* | 1001 | FRAMERATE_INPUT_TOO_LOW | |
* | 1002 | FRAMERATE_SENT_TOO_LOW | |
* | 1003 | SEND_VIDEO_BITRATE_TOO_LOW | |
* | 1005 | RECV_VIDEO_DECODE_FAILED | |
* | 2001 | AUDIO_INPUT_LEVEL_TOO_LOW | |
* | 2002 | AUDIO_OUTPUT_LEVEL_TOO_LOW | |
* | 2003 | SEND_AUDIO_BITRATE_TOO_LOW | |
* | 2005 | RECV_AUDIO_DECODE_FAILED | |
*
* ****
*
* | | | |
* | :----- | :------------------------- | :--------------- |
* |3001 | FRAMERATE_INPUT_TOO_LOW_RECOVER | |
* |3002 | FRAMERATE_SENT_TOO_LOW_RECOVER | |
* |3003 | SEND_VIDEO_BITRATE_TOO_LOW_RECOVER | |
* |3005 | RECV_VIDEO_DECODE_FAILED_RECOVER | |
* |4001 | AUDIO_INPUT_LEVEL_TOO_LOW_RECOVER | |
* |4002 | AUDIO_OUTPUT_LEVEL_TOO_LOW_RECOVER | |
* |4003 | SEND_AUDIO_BITRATE_TOO_LOW_RECOVER | |
* |4005 | RECV_AUDIO_DECODE_FAILED_RECOVER | |
*
* @asMemberOf IAgoraRTCClient
* @event
*/
declare function event_exception(event: {
/**
*
*/
code: number;
/**
*
*/
msg: string;
/**
* ID
*/
uid: UID;
}): void;
/**
*
*
* @event
* @asMemberOf IRemoteTrack
*/
declare function event_first_frame_decoded(): void;
/**
*
*
* ```javascript
* client.on("image-moderation-connection-state-change", (curState, preState) => {
* // image-moderation-connection-state-change: CONNECTING to CONNECTED
* console.info(`image-moderation-connection-state-change: ${preState} to ${curState}`);
* });
* ```
*
* @param newState
* @param preState
*
* @asMemberOf IAgoraRTCClient
* @event
*/
declare function event_image_moderation_connection_state_change(newState: ImageModerationConnectionState, preState: ImageModerationConnectionState): void;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.4.0*
*
* SDK
* - v4.10.0 [[publish]]
* - v4.10.0 [[join]]
*
* @param isUsingProxy
* - `true`:
* - `false`:
* @asMemberOf IAgoraRTCClient
* @event
*/
declare function event_is_using_cloud_proxy(isUsingProxy: boolean): void;
/**
* @deprecated
* 4.19.0 SDK 使
*
* SDK TCP/TLS 443
*
* v4.11.0 [[join]] SDK SD-RTN SDK TCP/TLS 443 SDK
*
* @param proxyServer 使
* @asMemberOf IAgoraRTCClient
* @event
*/
declare function event_join_fallback_to_proxy(proxyServer: string): void;
/**
*
*
* {@link startLiveStreaming}
*
* 访 `err.code`
* - `LIVE_STREAMING_INVALID_ARGUMENT`:
* - `LIVE_STREAMING_INTERNAL_SERVER_ERROR`:
* - `LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED`: URL
* - `LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED`:
* - `LIVE_STREAMING_CDN_ERROR`: CDN
* - `LIVE_STREAMING_INVALID_RAW_STREAM`:
*
* @param url
* @param err
* @asMemberOf IAgoraRTCClient
* @event
*/
declare function event_live_streaming_error(url: string, err: AgoraRTCError): void;
/**
*
*
* {@link startLiveStreaming}
*
* 访 `err.code`
* - `LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT`: 10
* - `LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE`:
* - `LIVE_STREAMING_WARN_FREQUENT_REQUEST`:
*
* @param url
* @param warning
* @asMemberOf IAgoraRTCClient
* @event
*/
declare function event_live_streaming_warning(url: string, warning: AgoraRTCError): void;
/**
* SDK
*
* @param uid ID `uid` `uid`
* @asMemberOf IAgoraRTCClient
* @event
*/
declare function event_media_reconnect_end(uid: UID): void;
/**
* SDK
*
* @param uid ID `uid` `uid`
* @asMemberOf IAgoraRTCClient
* @event
*/
declare function event_media_reconnect_start(uid: UID): void;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.18.0*
*
* {@link IAgoraRTC.on} {@link onMicrophoneChanged}
*
* ```javascript
* AgoraRTC.on("microphone-changed", (info) => {
* console.log("Microphone changed!", info.state, info.device);
* });
* ```
*
* @param deviceInfo {@link DeviceInfo}
* @asMemberOf IAgoraRTC
* @event
*/
declare function event_microphone_changed(deviceInfo: DeviceInfo): void;
/**
*
*
* SDK 2
*
* > 使
*
* @param stats
* @asMemberOf IAgoraRTCClient
* @event
*/
declare function event_network_quality(stats: NetworkQuality): void;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.18.0*
*
* {@link IAgoraRTC.on} {@link onPlaybackDeviceChanged}
*
* ```javascript
* AgoraRTC.on("playback-device-changed", (info) => {
* console.log("Playback device changed!", info.state, info.device);
* });
* ```
*
* @param deviceInfo {@link DeviceInfo}
* @asMemberOf IAgoraRTC
* @event
*/
declare function event_playback_device_changed(deviceInfo: DeviceInfo): void;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.11.0*
*
* 128 [[join]]
*
* >
* > - 使 ID`uid``published-user-list`
* > - `published-user-list` [AgoraRTCClient.on("user-joined")]{@link event_user_joined} [AgoraRTCClient.on("user-published")]{@link event_user_published}
* > - `published-user-list` `published-user-list` `user-joined` `user-published`
* > - `published-user-list``user-joined` `user-published`
*
* @param users
*
* @asMemberOf IAgoraRTCClient
* @event
*/
declare function event_published_user_list(users: IAgoraRTCRemoteUser[]): void;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.18.0*
*
* CSP {@link IAgoraRTC.on} {@link onSecurityPolicyViolation}
*
* ```javascript
* AgoraRTC.on("security-policy-violation", (info) => {
* console.log("Security policy violation!", info.state, info.device);
* });
* ```
*
* @asMemberOf IAgoraRTC
* @event
*/
declare function event_security_policy_violation(): void;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.20.1*
*
* H.264 SEI SEI
*
* @param sei Uint8Array SEI
* @asMemberOf ILocalVideoTrack
* @event
*/
declare function event_sei_received(sei: Uint8Array): void;
/**
* [BufferSourceAudioTrack]{@link IBufferSourceAudioTrack}
*
* @param currentState
* - `"stopped"`:
* - `"paused"`:
* - `"playing"`:
*
* @event
* @asMemberOf IBufferSourceAudioTrack
*/
declare function event_source_state_change(currentState: AudioSourceState): void;
/**
* 退
*
* {@link setStreamFallbackOption} `fallbackType` 2
* @param uid ID
* @param isFallbackOrRecover 退
* - `"fallback"`: 退
* - `"recover"`:
* @asMemberOf IAgoraRTCClient
* @event
*/
declare function event_stream_fallback(uid: UID, isFallbackOrRecover: "fallback" | "recover"): void;
/**
*
*
* ```javascript
* client.on("stream-message", (uid, payload) => {
* console.info(`received data stream message from ${uid}: `, payload);
* });
* ```
*
* @param uid ID
* @param payload
*
* @asMemberOf IAgoraRTCClient
* @event
*/
declare function event_stream_message(uid: UID, payload: Uint8Array): void;
/**
*
*
*
* @param uid ID
* @param streamType :
* - 0: 视频大流
* - 1: 视频小流
* @asMemberOf IAgoraRTCClient
* @event
*/
declare function event_stream_type_changed(uid: UID, streamType: RemoteStreamType): void;
/**
* Token
*
* token
*
* token {@link join} token
*
* ``` javascript
* client.on("token-privilege-did-expire", async () => {
* // 重新申请 token 后
* await client.join(<APPID>, <CHANNEL NAME>, <NEW TOKEN>);
* });
* ```
*
* @asMemberOf IAgoraRTCClient
* @event
*/
declare function event_token_privilege_did_expire(): void;
/**
* Token
*
* token 30
*
* token {@link renewToken} token
*
* ``` javascript
* client.on("token-privilege-will-expire", async function(){
* // 重新申请 token 后
* await client.renewToken(token);
* });
* ```
* @asMemberOf IAgoraRTCClient
* @event
*/
declare function event_token_privilege_will_expire(): void;
/**
*
* -
* -
* -
* - `MediaStreamTrack`
* -
* - 使
*
* @event
* @asMemberOf ILocalTrack
*/
declare function event_track_ended(): void;
/**
*
* @param track [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack)。
* @event
*/
declare function event_track_updated(track: MediaStreamTrack): void;
/**
* `RTCRtpTransceiver`
*
* @param transceiver `RTCRtpTransceiver`
* @param type {@link StreamType}
*
* @event
* @asMemberOf ILocalTrack
*/
declare function event_transceiver_updated(transceiver: RTCRtpTransceiver, type?: StreamType): void;
/**
* `RTCRtpTransceiver`
*
* @param transceiver `RTCRtpTransceiver`
*
* @event
* @asMemberOf IRemoteTrack
*/
declare function event_transceiver_updated_2(transceiver: RTCRtpTransceiver): void;
/**
* @ignore
*/
declare function event_user_datachannel_close(): void;
/**
* @ignore
*/
declare function event_user_datachannel_error(ev: Event): void;
/**
* @ignore
*/
declare function event_user_datachannel_message(data: ArrayBuffer): void;
/**
* @ignore
*/
declare function event_user_datachannel_open(): void;
/**
*
*
* [user-published]{@link IAgoraRTCClient.event_user_published} [user-unpublished]{@link IAgoraRTCClient.event_user_unpublished} SDK
*
* > 使 [user-published]{@link IAgoraRTCClient.event_user_published}
*
* @param uid ID
* @param msg `"enable-local-video"` `"disable-local-video"` Agora RTC Native SDK
* @asMemberOf IAgoraRTCClient
* @event
*/
declare function event_user_info_updated(uid: UID, msg: "mute-audio" | "mute-video" | "enable-local-video" | "unmute-audio" | "unmute-video" | "disable-local-video"): void;
/**
*
*
* - ID
* - ID 17
*
*
* - / {@link join}
* - {@link setClientRole}
* - /
*
* @param user
* @asMemberOf IAgoraRTCClient
* @event
*/
declare function event_user_joined(user: IAgoraRTCRemoteUser): void;
/**
* 线
*
* app 线线
* -
* - 线 20 线
* -
*
* >
* @param user 线
* @param reason 线
* - `"Quit"`: {@link leave}
* - `"ServerTimeOut"`: 线 SDK 使线
* - `"BecomeAudience"`:
* @asMemberOf IAgoraRTCClient
* @event
*/
declare function event_user_left(user: IAgoraRTCRemoteUser, reason: string): void;
/**
*
*
* {@link subscribe} [RemoteTrack.play]{@link IRemoteTrack.play}
*
* >
*
* ```javascript
* client.on("user-published", async (user, mediaType) => {
* await client.subscribe(user, mediaType);
* if (mediaType === "video") {
* console.log("subscribe video success");
* user.videoTrack.play("xxx");
* }
* if (mediaType === "audio") {
* console.log("subscribe audio success");
* user.audioTrack.play();
* }
* })
* ```
* @param user
* @param mediaType
* - `"audio"`:
* - `"video"`:
* - `"datachannel"`:
* @param config
*
* @asMemberOf IAgoraRTCClient
* @event
*/
declare function event_user_published(user: IAgoraRTCRemoteUser, mediaType: "audio" | "video" | "datachannel", config?: IDataChannelConfig): void;
/**
*
*
* @param user
* @param mediaType
* - `"audio"`:
* - `"video"`:
* - `"datachannel"`:
* @param config
* @asMemberOf IAgoraRTCClient
* @event
*/
declare function event_user_unpublished(user: IAgoraRTCRemoteUser, mediaType: "audio" | "video" | "datachannel", config?: IDataChannelConfig): void;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.8.0*
*
* HTML `<video>` SDK 30
*
* `localVideoTrack.play` SDK [HTML `<video>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video) 标签用于播放视频轨道。当 `localVideoTrack.isPlaying` 为 `true` 却看不到图像时,你可通过此事件来进行问题排查。
*
* @param data `<video>`
* @asMemberOf ILocalVideoTrack
* @event
*/
declare function event_video_element_visible_status(data?: CheckVideoVisibleResult): void;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.8.0*
*
* HTML `<video>` SDK 30
*
* `remoteVideoTrack.play` SDK [HTML `<video>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video) 标签用于播放视频轨道。当 `remoteVideoTrack.isPlaying` 为 `true` 却看不到图像时,你可通过此事件来进行问题排查。
*
* @param data `<video>`
* @asMemberOf IRemoteVideoTrack
* @event
*/
declare function event_video_element_visible_status_2(data?: CheckVideoVisibleResult): void;
/**
*
*
* @event
* @asMemberOf IRemoteTrack
*/
declare function event_video_state_changed(videoState: VideoState): void;
/**
*
*
* {@link enableAudioVolumeIndicator}
*
* 0 100 60
*
* ``` javascript
* client.on("volume-indicator", function(result){
* result.forEach(function(volume, index){
* console.log(`${index} UID ${volume.uid} Level ${volume.level}`);
* });
* });
* ```
*
* @param result
* - level 0 100
* - uid ID
*
* @asMemberOf IAgoraRTCClient
* @event
*/
declare function event_volume_indicator(result: {
/**
* 0 100
*/
level: number;
/**
* ID
*/
uid: UID;
}[]): void;
/**
* [AgoraRTCClient.sendCustomReportMessage]{@link IAgoraRTCClient.sendCustomReportMessage}
*/
export declare interface EventCustomReportParams {
/**
* ID
*/
reportId: string;
category: string;
/**
*
*/
event: string;
/**
*
*/
label: string;
/**
*
*/
value: number;
}
/**
* `EventEmitter`
*/
declare class EventEmitter {
private _events;
/**
*
*
* @param event -
*/
getListeners(event: string): Function[];
/**
*
*
* @param event -
* @param listener -
*/
on(event: string, listener: Function): void;
/**
*
*
*
*
* @param event -
* @param listener -
*/
once(event: string, listener: Function): void;
/**
*
*
* @param event -
* @param listener -
*/
off(event: string, listener: Function): void;
/**
*
*
* @param event -
*/
removeAllListeners(event?: string): void;
private _indexOfListener;
}
/**
* Agora Web SDK
*/
export declare interface IAgoraRTC extends EventEmitter {
/**
* Agora Web SDK
*/
VERSION: string;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.18.0*
*
* @param event
* @param listener {@link event_camera_changed}
*/
on(event: "camera-changed", listener: typeof event_camera_changed): void;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.18.0*
*
* @param event
* @param listener {@link event_microphone_changed}
*/
on(event: "microphone-changed", listener: typeof event_microphone_changed): void;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.18.0*
*
* @param event
* @param listener {@link event_playback_device_changed}
*/
on(event: "playback-device-changed", listener: typeof event_playback_device_changed): void;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.18.0*
*
* @param event
* @param listener {@link event_autoplay_failed}
*/
on(event: "autoplay-failed", listener: typeof event_autoplay_failed): void;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.18.0*
*
* @param event
* @param listener {@link event_security_policy_violation}
*/
on(event: "security-policy-violation", listener: typeof event_security_policy_violation): void;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.20.0*
*
* @param event
* @param listener {@link event_audio_context_state_changed}
*/
on(event: "audio-context-state-changed", listener: typeof event_audio_context_state_changed): void;
/**
*
*
* iOS App App
*
* {@link IAgoraRTC.on} `"audio-context-state-changed"` {@link event_audio_context_state_changed}
* - `"interrupted"` App `resumeAudioContext`
* - `"running"`
*
* @returns
*/
resumeAudioContext(): void;
/**
* Agora Web SDK
*
* VP8 H.264 OPUS
*
* >
* > - WebRTC
* > - SDP
* > - H.264 H.264 使 VP8
*
* ```javascript
* AgoraRTC.getSupportedCodec().then(result => {
* console.log(`Supported video codec: ${result.video.join(",")}`);
* console.log(`Supported audio codec: ${result.audio.join(",")}`);
* });
* ```
* @returns `Promise` `.then(function(result){})` `result`
* - `video`: `"H264"``"VP8"`
* - `audio`: `"OPUS"`
*/
getSupportedCodec(): Promise<{
video: string[];
audio: string[];
}>;
/**
* Agora Web SDK 使
*
* {@link createClient}
*
* @returns
* - `true`:
* - `false`:
*/
checkSystemRequirements(): boolean;
/**
* 使`appid``channel``token``uid`
*
*
*
* Token
*
* > -
* > -
* > - 10
* > - proxy
*
* @param appid [App ID](https://doc.shengwang.cn/basics/glossary#app-id)。
*
* @param token token
* - token `null`
* - 安全要求不高: 你可以使用控制台生成的临时 token[ RTC Token](http://doc.shengwang.cn/doc/rtc/javascript/get-started/enable-service)。
* - token[使 Token ](http://doc.shengwang.cn/doc/rtc/javascript/basic-features/token-authentication)。
*
* @param channel 64 89 :
* - 26 a-z
* - 26 A-Z
* - 10 0-9
* -
* - "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", "{", "}", "|", "~", ","
*
* @param uid IDASCII `null` uid
* - 使 ID 32 0 (2<sup>32</sup>-1)
* - 使 ID 255
*
* <div class="alert warning">使 ID</div>
*
* >
* > - 使 `uid`
* > - 使 ID Native SDK 2.8 Native SDK 使 User Account [使 String ](https://docs.agora.io/cn/faq/string)。
* > - `uid`
*/
preload(appid: string, channel: string, token: string | null, uid?: UID | null): Promise<void>;
/**
* /使 Agora Web SDK
*
* @param config - 使 `vp8` `rtc` {@link ClientConfig}
* @category Agora Core
*/
createClient(config: ClientConfig): IAgoraRTCClient;
/**
*
*
* 使 [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack) 转换成一个可以用于 SDK 的音频轨道。
*
* @param config [[CustomAudioTrackInitConfig]]
* @category Local Track
*/
createCustomAudioTrack(config: CustomAudioTrackInitConfig): ILocalAudioTrack;
/**
*
*
* @param config {@link MicrophoneAudioTrackInitConfig}
* @category Local Track
*/
createMicrophoneAudioTrack(config?: MicrophoneAudioTrackInitConfig): Promise<IMicrophoneAudioTrack>;
/**
* [AudioBuffer](https://developer.mozilla.org/zh-CN/docs/Web/API/AudioBuffer) 对象创建一个音频轨道。
*
* 线
* - MP3
* - AAC
* -
*
* @param config
*
* @returns
* @category Local Track
*/
createBufferSourceAudioTrack(config: BufferSourceAudioTrackInitConfig): Promise<IBufferSourceAudioTrack>;
/**
*
*
* 使 [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack) 转换成一个可以用于 SDK 的视频轨道。
*
* @param config {@link CustomVideoTrackInitConfig}
* > v4.17.1 [config]{@link CustomVideoTrackInitConfig}
* @category Local Track
*/
createCustomVideoTrack(config: CustomVideoTrackInitConfig): ILocalVideoTrack;
/**
*
*
* @param config {@link CameraVideoTrackInitConfig}
* @category Local Track
*/
createCameraVideoTrack(config?: CameraVideoTrackInitConfig): Promise<ICameraVideoTrack>;
/**
*
*
*
*
* > {@link createMicrophoneAudioTrack} {@link createCameraVideoTrack}
* > -
* > -
* @param audioConfig
* @param videoConfig
* @category Local Track
*/
createMicrophoneAndCameraTracks(audioConfig?: MicrophoneAudioTrackInitConfig, videoConfig?: CameraVideoTrackInitConfig): Promise<[IMicrophoneAudioTrack, ICameraVideoTrack]>;
/**
*
*
* @param config
* @param withAudio ****
* - `enable`:
* - `disable`:
* - `auto`:
* >
* > - Web SDK [](https://doc.shengwang.cn/doc/rtc/javascript/overview/browser-compatibility)。
* > -
* > - macOS Chrome 74 Chrome Firefox Safari 14
* > - Windows Chrome 74 Edge Firefox
* > - ChromeOS Chrome
* > - `withAudio` `enable` ****
* @returns
* - `withAudio` `enable`****SDK
* - `withAudio` `disable`
* - `withAudio` `auto` SDK
* - ****
* - ****
* @category Local Track
*/
createScreenVideoTrack(config: ScreenVideoTrackInitConfig, withAudio: "enable"): Promise<[ILocalVideoTrack, ILocalAudioTrack]>;
/**
*
*
* @param config
* @param withAudio ****
* - `enable`:
* - `disable`:
* - `auto`:
* >
* > - Web SDK [](https://doc.shengwang.cn/doc/rtc/javascript/overview/browser-compatibility)。
* > -
* > - macOS Chrome 74 Chrome Firefox Safari 14
* > - Windows Chrome 74 Edge Firefox
* > - ChromeOS Chrome
* > - `withAudio` `enable` ****
* @returns
* - `withAudio` `enable`****SDK
* - `withAudio` `disable`
* - `withAudio` `auto` SDK
* - ****
* - ****
*/
createScreenVideoTrack(config: ScreenVideoTrackInitConfig, withAudio: "disable"): Promise<ILocalVideoTrack>;
/**
*
*
* @param config
* @param withAudio ****
* - `enable`:
* - `disable`:
* - `auto`:
* >
* > - Web SDK [](https://doc.shengwang.cn/doc/rtc/javascript/overview/browser-compatibility)。
* > -
* > - macOS Chrome 74 Chrome Firefox Safari 14
* > - Windows Chrome 74 Edge Firefox
* > - ChromeOS Chrome
* > - `withAudio` `enable` ****
* @returns
* - `withAudio` `enable`****SDK
* - `withAudio` `disable`
* - `withAudio` `auto` SDK
* - ****
* - ****
*/
createScreenVideoTrack(config: ScreenVideoTrackInitConfig, withAudio?: "enable" | "disable" | "auto"): Promise<[ILocalVideoTrack, ILocalAudioTrack] | ILocalVideoTrack>;
/**
*
* SDK [MediaDeviceInfo](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo) 对象返回可用的媒体设备。
*
* >
* > - Chrome 67+Firefox 70+ Safari 12+
* > - 使SDK [MediaDeviceInfo.deviceId](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo/deviceId) 也可能会发生变化,例如用户清除 Cookie 后,`deviceId` 就会被重置。因此,声网不建议基于 `deviceId` 开发业务逻辑。
*
* ```javascript
* getDevices().then(devices => {
* console.log("first device id", devices[0].deviceId);
* }).catch(e => {
* console.log("get devices error!", e);
* });
* ```
* @param skipPermissionCheck `true` SDK
* - `true`:
* - `false`:
* @category Media Devices
*/
getDevices(skipPermissionCheck?: boolean): Promise<MediaDeviceInfo[]>;
/**
*
*
* SDK [MediaDeviceInfo](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo) 对象返回可用的音频输入设备。
*
* > Chrome 67+Firefox 70+ Safari 12+
*
* @param skipPermissionCheck `true` SDK
* - `true`:
* - `false`:
* @category Media Devices
*/
getMicrophones(skipPermissionCheck?: boolean): Promise<MediaDeviceInfo[]>;
/**
*
*
* SDK [MediaDeviceInfo](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo) 对象返回可用的视频输入设备。
*
* > Chrome 67+Firefox 70+ Safari 12+
*
* @param skipPermissionCheck `true` SDK
* - `true`:
* - `false`:
* @category Media Devices
*/
getCameras(skipPermissionCheck?: boolean): Promise<MediaDeviceInfo[]>;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.1.0*
*
*
*
* SDK [MediaDeviceInfo](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo) 对象返回可用的音频播放设备。
*
* > - ChromeFirefoxEdge Safari
* > - Chrome 67+ Firefox 70+
*
* @param skipPermissionCheck `true` SDK
* - `true`:
* - `false`:
* @category Media Devices
*/
getPlaybackDevices(skipPermissionCheck?: boolean): Promise<MediaDeviceInfo[]>;
/**
* Electron
*
* SDK {@link ElectronDesktopCapturerSource}
*
* > Electron contextIsolation 使 contextBridge.exposeInMainWorld id
* ```
* // preload.js
*
* const {
* contextBridge, desktopCapturer
* } = require("electron");
*
* contextBridge.exposeInMainWorld(
* "electronDesktopCapturer", {
* getSources: async (...args) => {
* const sources = await desktopCapturer.getSources(...args);
* return sources;
* }
* }
* );
*
* // renderer.js
* (async () => {
* sources = await window.electronDesktopCapturer.getSources(["window", "screen"]);
* const source = sources[0]; // just for example ,you shuould make an UI for user to select the exact source.
* const screenVideoTrack = await AgoraRTC.createScreenVideoTrack({ electronScreenSourceId: source.id });
* })()
*
* ```
* @param type - // {@link ScreenSourceType}
* @public
* @category Media Devices
*/
getElectronScreenSources(type?: ScreenSourceType): Promise<ElectronDesktopCapturerSource[]>;
/** @ignore
* appType,, 0
*/
setAppType(type: AppType): void;
/**
* SDK
*
*
* @param level - SDK
* - 0: DEBUG SDK
* - 1: INFO INFOWARNING ERROR
* - 2: WARNING WARNING ERROR
* - 3: ERROR ERROR
* - 4: NONE
*
* `AgoraRTC.setLogLevel(1);` INFOWARNING ERROR
* @category Logger
*/
setLogLevel(level: number): void;
/**
* SDK
*
*
*
* >
* @category Logger
*/
enableLogUpload(): void;
/**
*
*
* {@link enableLogUpload})
* @category Logger
*/
disableLogUpload(): void;
/**
*
*/
createChannelMediaRelayConfiguration(): IChannelMediaRelayConfiguration;
/**
*
*
* SDK
*
*
*
* >
* > - mute `false`
* > -
*
* ``` javascript
* const videoTrack = await AgoraRTC.createCameraVideoTrack({ cameraId });
* AgoraRTC.checkVideoTrackIsActive(videoTrack).then(result => {
* console.log(`${ cameraLabel } is ${ result ? "available" : "unavailable" }`);
* }).catch(e => {
* console.log("check video track error!", e);
* });
* ```
*
* @param track
* @param timeout 5,000
*
* @returns
* - `true`:
* - `false`: mute
*/
checkVideoTrackIsActive(track: ILocalVideoTrack | IRemoteVideoTrack, timeout?: number): Promise<boolean>;
/**
*
*
* SDK
*
*
*
* >
* > - 使
* > - mute `false`
* > -
*
* ``` javascript
* const audioTrack = await AgoraRTC.createMicrophoneAudioTrack({ microphoneId });
* AgoraRTC.checkAudioTrackIsActive(audioTrack).then(result => {
* console.log(`${ microphoneLabel } is ${ result ? "available" : "unavailable" }`);
* }).catch(e => {
* console.log("check audio track error!", e);
* });
* ```
*
* @param track
* @param timeout 5,000
*
* @returns
* - `true`:
* - `false`: mute
*/
checkAudioTrackIsActive(track: ILocalAudioTrack | IRemoteAudioTrack, timeout?: number): Promise<boolean>;
/**
*
*
*
*
* >
*
* ``` javascript
* AgoraRTC.onCameraChanged = (info) => {
* console.log("camera changed!", info.state, info.device);
* };
* ```
* **Parameters**
*
* - **deviceInfo** {@link DeviceInfo}
* @category Global Callback
*/
onCameraChanged?: (deviceInfo: DeviceInfo) => void;
/**
*
*
*
*
* >
*
* ``` javascript
* AgoraRTC.onMicrophoneChanged = (info) => {
* console.log("microphone changed!", info.state, info.device);
* };
* ```
* **Parameters**
*
* - **deviceInfo** {@link DeviceInfo}
* @category Global Callback
*/
onMicrophoneChanged?: (deviceInfo: DeviceInfo) => void;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.1.0*
*
*
*
*
*
* ``` javascript
* AgoraRTC.onPlaybackDeviceChanged = (info) => {
* console.log("speaker changed!", info.state, info.device);
* };
* ```
* **Parameters**
*
* - **deviceInfo** {@link DeviceInfo}
* @category Global Callback
*/
onPlaybackDeviceChanged?: (deviceInfo: DeviceInfo) => void;
/**
*
*
* @deprecated
*
* 4.6.0 [[onAutoplayFailed]]
*
* `play`SDK `onAudioAutoplayFailed`
*
* [](https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide#Autoplay_and_autoplay_blocking)导致的,视频轨道的播放不受此影响。
*
* Agora Web SDK
* - `onAudioAutoplayFailed` `RemoteAudioTrack.play` `LocalAudioTrack.play`
* - `RemoteAudioTrack.play` `LocalAudioTrack.play` `onAudioAutoplayFailed`
*
* > 使使 JavaScript
*
*
*
* ```javascript
* let isAudioAutoplayFailed = false;
* AgoraRTC.onAudioAutoplayFailed = () => {
* if (isAudioAutoplayFailed) return;
*
* isAudioAutoplayFailed = true;
* const btn = document.createElement("button");
* btn.innerText = "Click me to resume the audio playback";
* btn.onClick = () => {
* isAudioAutoplayFailed = false;
* btn.remove();
* };
* document.body.append(btn);
* };
* ```
* > `play` `onAudioAutoplayFailed` `isAudioAutoplayFailed`
*
* @category Global Callback
*/
onAudioAutoplayFailed?: () => void;
/**
*
*
* @自从
* <br>&emsp;&emsp;&emsp;*4.6.0*
*
* SDK
*
* - [](https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide#Autoplay_and_autoplay_blocking)导致的。
* - iOS Safari iOS `WKWebView` iOS
*
* Agora Web SDK
* - `onAutoplayFailed` `RemoteTrack.play` `LocalTrack.play`
* - `RemoteTrack.play` `LocalTrack.play` `onAutoplayFailed`
*
* > 使使 JavaScript
*
*
*
* ```javascript
* AgoraRTC.onAutoplayFailed = () => {
* const btn = document.createElement("button");
* btn.innerText = "Click me to resume the audio/video playback";
* btn.onClick = () => {
* btn.remove();
* };
* document.body.append(btn);
* ```
* > `onAutoplayFailed` `onAudioAutoplayFailed` `isAutoplayFailed`
*
* @category Global Callback
* */
onAutoplayFailed?: () => void;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.15.0*
*
* CSP
*
* CSPContent Security PolicySDK
* CSP
*
* @category Global Callback
*/
onSecurityPolicyViolation?: (event: SecurityPolicyViolationEvent) => void;
/**
* @ignore
*
* SDK
*/
onAudioContextStateChanged?: (currState: AudioContextState | "interrupted", prevState: AudioContextState | "interrupted" | undefined) => void;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.2.0*
*
* 访
*
* 访
*
* SDK 访SDK
*
* ```javascript
* // 指定仅访问北美的服务器。
* AgoraRTC.setArea({
* areaCode:"NORTH_AMERICA"
* })
* ```
*
* @param area 访 {@link AREAS} `areaCode` 访
*/
setArea(area: AREAS[] | {
areaCode: AREAS[];
excludedArea?: AREAS;
}): void;
/**
*
* @自从
* <br>&emsp;&emsp;&emsp;*4.5.0*
*
*
*
* A Chrome [HTMLMediaElement](https://developer.mozilla.org/zh-CN/docs/Web/API/HTMLMediaElement) 使用扬声器播放媒体文件,扬声器播放的声音会和人声一起被 SDK 采集,因此其他用户会听到自己本地播放的媒体音频以及用户 A 发送的媒体音频,从而产生回声。针对这种情况,你可以调用 `processExternalMediaAEC` 方法传入 `HTMLMediaElement`,对本地播放的媒体进行回声消除,提升音频体验。
*
* ```javascript
* <audio crossOrigin="anonymous" src="http://www.test.com/test.mp3" id="audioDom"></audio>
* <script>
* const element = document.getElementById("audioDom");
* AgoraRTC.processExternalMediaAEC(element);
* </script>
* ```
*
* > [HTMLMediaElement](https://developer.mozilla.org/zh-CN/docs/Web/API/HTMLMediaElement) 中的 `crossOrigin` 属性为 `"anonymous"` 以允许跨域媒体被重采集。
*
* @param element [HTMLMediaElement](https://developer.mozilla.org/zh-CN/docs/Web/API/HTMLMediaElement)。
*/
processExternalMediaAEC(element: HTMLMediaElement): void;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.10.0*
*
*
*
*
* - [](http://doc.shengwang.cn/doc/rtc/javascript/advanced-features/virtual-background)
* - [AI ](http://doc.shengwang.cn/doc/rtc/javascript/advanced-features/noise-reduction)
* - [](http://doc.shengwang.cn/doc/rtc/javascript/advanced-features/image-enhancement)
*
* @param extensions
*/
registerExtensions(extensions: IExtension<any>[]): void;
}
/**
*
*
* [[createClient]] `AgoraRTCClient` `AgoraRTCClient`
* @public
*/
export declare interface IAgoraRTCClient extends EventEmitter {
/**
* SDK
*/
readonly connectionState: ConnectionState;
/**
* ID
*
*
*/
readonly remoteUsers: IAgoraRTCRemoteUser[];
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.0.0*
*
*
*
* - [[publish]]
* - [[unpublish]]
*/
readonly localTracks: ILocalTrack[];
/**
* ID
*
* `undefined`
*/
readonly uid?: UID;
/**
*
*
* `undefined`
*/
readonly channelName?: string;
/**
* @ignore
* datachannel
*
* `[]`
*/
readonly localDataChannels: ILocalDataChannel[];
/**
* @ignore
* @自从
* <br>&emsp;&emsp;&emsp;*4.18.1*
*
*
*/
readonly mode: SDK_MODE;
/**
* @ignore
* @自从
* <br>&emsp;&emsp;&emsp;*4.18.1*
*
*
*/
readonly role: ClientRole;
/**
* @param event
* @param listener [connection-state-change]{@link event_connection_state_change}
*/
on(event: "connection-state-change", listener: typeof event_connection_state_change): void;
/**
* @param event
* @param listener [user-joined]{@link event_user_joined}
*/
on(event: "user-joined", listener: typeof event_user_joined): void;
/**
* @param event
* @param listener [user-left]{@link event_user_left}
*/
on(event: "user-left", listener: typeof event_user_left): void;
/**
* @param event
* @param listener [user-published]{@link event_user_published}
*/
on(event: "user-published", listener: typeof event_user_published): void;
/**
* @param event
* @param listener [user-unpublished]{@link event_user_unpublished}
*/
on(event: "user-unpublished", listener: typeof event_user_unpublished): void;
/**
* @param event
* @param listener [user-info-updated]{@link event_user_info_updated}
*/
on(event: "user-info-updated", listener: typeof event_user_info_updated): void;
/**
* @param event
* @param listener [media-reconnect-start]{@link event_media_reconnect_start}
*/
on(event: "media-reconnect-start", listener: typeof event_media_reconnect_start): void;
/**
* @param event
* @param listener [media-reconnect-end]{@link event_media_reconnect_end}
*/
on(event: "media-reconnect-end", listener: typeof event_media_reconnect_end): void;
/**
* @param event
* @param listener [stream-type-changed]{@link event_stream_type_changed}
*/
on(event: "stream-type-changed", listener: typeof event_stream_type_changed): void;
/**
* @param event
* @param listener [stream-fallback]{@link event_stream_fallback}
*/
on(event: "stream-fallback", listener: typeof event_stream_fallback): void;
/**
* @param event
* @param listener [channel-media-relay-state]{@link event_channel_media_relay_state}
*/
on(event: "channel-media-relay-state", listener: typeof event_channel_media_relay_state): void;
/**
* @param event
* @param listener [channel-media-relay-event]{@link event_channel_media_relay_event}
*/
on(event: "channel-media-relay-event", listener: typeof event_channel_media_relay_event): void;
/**
* @param event
* @param listener [volume-indicator]{@link event_volume_indicator}
*/
on(event: "volume-indicator", listener: typeof event_volume_indicator): void;
/**
* @param event
* @param listener [crypt-error]{@link event_crypt_error}
*/
on(event: "crypt-error", listener: typeof event_crypt_error): void;
/**
* @param event
* @param listener [token-privilege-will-expire]{@link event_token_privilege_will_expire}
*/
on(event: "token-privilege-will-expire", listener: typeof event_token_privilege_will_expire): void;
/**
* @param event
* @param listener [token-privilege-did-expire]{@link event_token_privilege_did_expire}
*/
on(event: "token-privilege-did-expire", listener: typeof event_token_privilege_did_expire): void;
/**
* @param event
* @param listener [network-quality]{@link event_network_quality}
*/
on(event: "network-quality", listener: typeof event_network_quality): void;
/**
* @param event
* @param listener [live-streaming-error]{@link event_live_streaming_error}
*/
on(event: "live-streaming-error", listener: typeof event_live_streaming_error): void;
/**
* @param event
* @param listener [live-streaming-warning]{@link event_live_streaming_warning}
*/
on(event: "live-streaming-warning", listener: typeof event_live_streaming_warning): void;
/**
* @param event
* @param listener [exception]{@link event_exception}
*/
on(event: "exception", listener: typeof event_exception): void;
/**
* @param event
* @param listener [is-using-cloud-proxy]{@link event_is_using_cloud_proxy}
*/
on(event: "is-using-cloud-proxy", listener: typeof event_is_using_cloud_proxy): void;
/**
* @deprecated
* 4.19.0
*
* @param event
* @param listener [join-fallback-to-proxy]{@link event_join_fallback_to_proxy}
*/
on(event: "join-fallback-to-proxy", listener: typeof event_join_fallback_to_proxy): void;
/**
* @param event
* @param listener [published-user-list]{@link event_published_user_list}
*/
on(event: "published-user-list", listener: typeof event_published_user_list): void;
/**
* @param event
* @param listener [content-inspect-connection-state-change]{@link event_content_inspect_connection_state_change}
*/
on(event: "content-inspect-connection-state-change", listener: typeof event_content_inspect_connection_state_change): void;
/**
* @param event
* @param listener [content-inspect-error]{@link event_content_inspect_error}
*/
on(event: "content-inspect-error", listener: typeof event_content_inspect_error): void;
/**
*
*
* @param event
* @param listener [image-moderation-connection-state-change]{@link event_image_moderation_connection_state_change}
*/
on(event: "image-moderation-connection-state-change", listener: typeof event_image_moderation_connection_state_change): void;
/**
* @param event
* @param listener [stream-message]{@link event_stream_message}
*/
on(event: "stream-message", listener: typeof event_stream_message): void;
/**
*
* @param event
* @param listener
*/
on(event: string, listener: Function): void;
/**
*
*
*
*
* [AgoraRTCClient.on("connection-state-change")]{@link IAgoraRTCClient.event_connection_state_change}
*
* [AgoraRTCClient.on("user-joined")]{@link IAgoraRTCClient.event_user_joined}
*
* @param appid [App ID](https://doc.shengwang.cn/basics/glossary#app-id)。
*
* @param token token
* - token `null`
* - 安全要求不高: 你可以使用控制台生成的临时 token[ RTC Token](http://doc.shengwang.cn/doc/rtc/javascript/get-started/enable-service)。
* - token[使 Token ](http://doc.shengwang.cn/doc/rtc/javascript/basic-features/token-authentication)。
*
* @param channel 64 89 :
* - 26 a-z
* - 26 A-Z
* - 10 0-9
* -
* - "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", "{", "}", "|", "~", ","
* @param uid IDASCII `null` uid Promise
* - 使 ID 32 0 (2<sup>32</sup>-1)
* - 使 ID 255
*
* <div class="alert warning">使 ID</div>
*
* >
* > - 使 `uid`
* > - 使 ID Native SDK 2.8 Native SDK 使 User Account [使 String ](https://docs.agora.io/cn/faq/string)。
* > - `uid`
*
* @return Promise ID
* - 使 uid uid
* - 使 uid uid
* - `null` uid
* @category Agora Core
*/
join(appid: string, channel: string, token: string | null, uid?: UID | null): Promise<UID>;
/**
*
*
* 退
*
* [AgoraRTCClient.on("connection-state-change")]{@link IAgoraRTCClient.event_connection_state_change}
*
* [AgoraRTCClient.on("user-left")]{@link IAgoraRTCClient.event_user_left}
* @category Agora Core
*/
leave(): Promise<void>;
/**
*
*
*
*
* [AgoraRTCClient.on("user-published")]{@link event_user_published}
*
* >
* > - {@link setClientRole}
* > -
* > - `AgoraRTCClient` SDK Safari 12
* > - `AgoraRTCClient` ****
*
* @param tracks [AgoraRTC.createMicrophoneAudioTrack]{@link IAgoraRTC.createMicrophoneAudioTrack} / [AgoraRTC.createCameraTrack]{@link IAgoraRTC.createCameraVideoTrack} Track
* @category Agora Core
*/
publish(tracks: ILocalTrack | ILocalTrack[]): Promise<void>;
/** @ignore */
publish(config: IDataChannelConfig): Promise<ILocalDataChannel>;
/** @ignore */
publish(params: ILocalTrack | ILocalTrack[] | IDataChannelConfig): Promise<ILocalDataChannel | void>;
/**
*
*
* [AgoraRTCClient.on("user-unpublished")]{@link event_user_unpublished}
*
* > [unpublish]{@link unpublish} {@link setClientRole}
*
* @param tracks
* @category Agora Core
*/
unpublish(tracks?: ILocalTrack | ILocalTrack[]): Promise<void>;
/** @ignore */
unpublish(dataChannel?: ILocalDataChannel): Promise<void>;
/** @ignore */
unpublish(params?: ILocalTrack | ILocalTrack[] | ILocalDataChannel): Promise<void>;
/**
*
*
* ```javascript
* await client.subscribe(user"audio");
* user.audioTrack.play();
* ```
*
* @param user
* @param mediaType
* - `"video"`:
* - `"audio"`:
*
* @returns [user.audioTrack]{@link IAgoraRTCRemoteUser.audioTrack} [user.videoTrack]{@link IAgoraRTCRemoteUser.videoTrack}
* [audioTrack.play]{@link IRemoteAudioTrack.play} [videoTrack.play]{@link IRemoteVideoTrack.play}
* > `TRACK_IS_NOT_PUBLISHED`
* @category Agora Core
*/
subscribe(user: IAgoraRTCRemoteUser | UID, mediaType: "video"): Promise<IRemoteVideoTrack>;
/**
*
*
* ```javascript
* await client.subscribe(user"audio");
* user.audioTrack.play();
* ```
* @param user
* @param mediaType
* - `"video"`:
* - `"audio"`:
*
* @returns [user.audioTrack]{@link IAgoraRTCRemoteUser.audioTrack} [user.videoTrack]{@link IAgoraRTCRemoteUser.videoTrack}
* [audioTrack.play]{@link IRemoteAudioTrack.play} [videoTrack.play]{@link IRemoteVideoTrack.play}
* > `TRACK_IS_NOT_PUBLISHED`
* @category Agora Core
*/
subscribe(user: IAgoraRTCRemoteUser | UID, mediaType: "audio"): Promise<IRemoteAudioTrack>;
/**
* @ignore
* @param user
* @param mediaType
* @param channelId
*/
subscribe(user: IAgoraRTCRemoteUser | UID, mediaType: "datachannel", channelId: number): Promise<IRemoteDataChannel>;
/**
*
*
* ```javascript
* await client.subscribe(user"audio");
* user.audioTrack.play();
* ```
* @param user
* @param mediaType
* - `"video"`:
* - `"audio"`:
* - `"datachannel"`:
*
* @returns [user.audioTrack]{@link IAgoraRTCRemoteUser.audioTrack} [user.videoTrack]{@link IAgoraRTCRemoteUser.videoTrack}
* [audioTrack.play]{@link IRemoteAudioTrack.play} [videoTrack.play]{@link IRemoteVideoTrack.play}
* > `TRACK_IS_NOT_PUBLISHED`
* @category Agora Core
*/
subscribe(user: IAgoraRTCRemoteUser | UID, mediaType: "video" | "audio" | "datachannel", channelId?: number): Promise<IRemoteTrack | IRemoteDataChannel>;
presubscribe(uid: UID, mediaType: "audio"): Promise<IRemoteAudioTrack>;
presubscribe(uid: UID, mediaType: "video"): Promise<IRemoteVideoTrack>;
presubscribe(uid: UID, mediaType: "video" | "audio"): Promise<IRemoteTrack>;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.11.0*
*
*
*
* ```javascript
* const result = await client.massSubscribe([{user:userA, mediaType:'audio'}, {user: userB, mediaType:'audio'}]);
*
* for(const {track, mediaType, error} of result) {
* if(error) {
* console.error(error);
* continue;
* }
*
* if(track) {
* if(mediaType === 'audio') {
* track.play();
* }else{
* track.play(document.querySelector('.video-container'));
* }
* }
* }
* ```
*
* @param subscribeList
* - `user` [AgoraRTCRemoteUser]{@link IAgoraRTCRemoteUser}
* - `mediaType`
* - `"video"`:
* - `"audio"`:
*
* @returns `subscribeList`
* - `user` [AgoraRTCRemoteUser]{@link IAgoraRTCRemoteUser}
* - `mediaType`
* - `"video"`:
* - `"audio"`:
* - `track` [RemoteTrack]{@link IRemoteTrack}
* - `error`
*/
massSubscribe(subscribeList: {
user: IAgoraRTCRemoteUser;
mediaType: "audio" | "video";
}[]): Promise<{
user: IAgoraRTCRemoteUser;
mediaType: "audio" | "video";
track?: IRemoteTrack;
error?: AgoraRTCError;
}[]>;
/**
*
*
* @param user
* @param mediaType
* - `"video"`:
* - `“audio”`:
* -
* - `"datachannel"`:
* @param channelId
* @returns `TRACK_IS_NOT_SUBSCRIBED`
* @category Agora Core
*/
unsubscribe(user: IAgoraRTCRemoteUser | UID, mediaType?: "video" | "audio" | "datachannel", channelId?: number): Promise<void>;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.11.0*
*
*
*
* ```javascript
* client.massUnsubscribe([{user:userA}, {user: userB}]);
* ```
* @param unsubscribeList
* - `user` [AgoraRTCRemoteUser]{@link IAgoraRTCRemoteUser}
* - `mediaType`
* - `"video"`:
* - `"audio"`:
* -
*/
massUnsubscribe(unsubscribeList: {
user: IAgoraRTCRemoteUser;
mediaType?: "audio" | "video";
}[]): Promise<void>;
/**
*
*
* {@link enableDualStream}
*
* SDK
*
* >
* > - `setLowStreamParameter`
* > - Firefox 30 fps Mac Firefox 73+
* > - Safari 14 17.2 15 fps iOS Safari `LowStreamParameter.bitrate`
* > -
* @param streamParameter -
* @category Dual Stream
*/
setLowStreamParameter(streamParameter: LowStreamParameter): void;
/**
*
*
*
* -
* - × 160 × 120 50 Kbps 15 fps使 {@link setLowStreamParameter}
*
* >
* > - Android `enableDualStream`
* > - Android Chrome 使 H.264
* > - 使 Intel Mac Safari `enableDualStream` H.264 1/4
*
* ```javascript
* client.enableDualStream().then(() => {
* console.log("Enable Dual stream success!");
* }).catch(err => {
* console.log(err);
* })
* ```
* @category Dual Stream
*/
enableDualStream(): Promise<void>;
/**
*
* @category Dual Stream
*/
disableDualStream(): Promise<void>;
/**
* [mode]{@link ClientConfig.mode} `"live"`
*
* - (role) SDK CDN `"host"` `"audience"` {@link publish}
* - (level)
*
* >
* > - [mode]{@link ClientConfig.mode} `"rtc"`使 `"host"`
* > - [AgoraRTCClient.on("user-joined")]{@link event_user_joined} [AgoraRTCClient.on("user-left")]{@link event_user_left}
* > - {@link publish} `"audience"` {@link unpublish}
*
* @param role
* @param options
*/
setClientRole(role: ClientRole, options?: ClientRoleOptions): Promise<void>;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.18.0*
*
*
*
* {@link startProxyServer}
* - `setProxyServer`
* - `startProxyServer`使[使](http://doc.shengwang.cn/doc/rtc/javascript/basic-features/firewall)。
*
* >
* > - {@link join}
* > - 使 Firefox 使使使 Firefox
*
* @param proxyServer ASCII
* @category Proxy
*/
setProxyServer(proxyServer: string): void;
/**
* @ignore
* TURN
*
* Agora Web SDK {@link startProxyServer}
*
* > {@link join}
*
* @param turnServer - TURN
* @category Proxy
*/
setTurnServer(turnServer: TurnServerConfig): void;
/**
*
*
*
*
* 使[使](http://doc.shengwang.cn/doc/rtc/javascript/basic-features/firewall)。
*
* @param mode
* - `3`: UDP Force UDP SDK UDP
* - `5`: TCP Force TCP SDK TLS 443
*
* >
* > v4.15.0 `mode` `3`
*
* @category Proxy
*/
startProxyServer(mode?: number): void;
/**
*
*
*
* @category Proxy
*/
stopProxyServer(): void;
/**
*
*
* `setRemoteVideoStreamType`
*
* > - {@link enableDualStream} 使
* > - {@link setStreamFallbackOption}
* > - {@link setStreamFallbackOption} `0` (DISABLE) `setRemoteVideoStreamType`
* > - {@link setStreamFallbackOption} `1` (VIDEO_STREAM_LOW) `2` (VIDEO_STREAM_HIGH) `setRemoteVideoStreamType` `setRemoteVideoStreamType` `0`SDK `setStreamFallbackOption` 退
*
* @param uid ID
* @param streamType 0 1 {@link RemoteStreamType}
* @category Dual Stream
*/
setRemoteVideoStreamType(uid: UID, streamType: RemoteStreamType): Promise<void>;
/**
*
*
* `subscribe` `streamType`
*
* > - `setRemoteDefaultVideoStreamType`
* > - {@link setRemoteVideoStreamType}
*
* @param streamType 0 1 {@link RemoteStreamType}
* @category Dual Stream
*/
setRemoteDefaultVideoStreamType(streamType: RemoteStreamType): Promise<void>;
/**
* @ignore
*/
pickSVCLayer(uid: UID, layerOptions: {
spatialLayer: 0 | 1 | 2 | 3;
temporalLayer: 0 | 1 | 2 | 3;
}): Promise<void>;
/**
* @ignore
*/
setRTMConfig(config: RTMConfiguration): Promise<void>;
/**
* 退
*
* 退SDK
*
* 退
* [AgoraRTCClient.on("stream-type-changed")]{@link event_stream_type_changed} 退 [AgoraRTCClient.on("stream-fallback")]{@link event_stream_fallback}
*
* > - {@link enableDualStream}
* > - `setStreamFallbackOption`退 SDK {@link RemoteStreamFallbackType} `1`
*
* @param uid UID
* @param fallbackType 退 {@link RemoteStreamFallbackType}
* @category Dual Stream
*/
setStreamFallbackOption(uid: UID, fallbackType: RemoteStreamFallbackType): Promise<void>;
/**
*
*
* SDK
*
* [AgoraRTCClient.on("crypt-error")]{@link event_crypt_error}
*
* >
* > -
* > -
* > - v4.7.0 SDK
* > - CDN 使
*
* @param encryptionMode
* @param secret ASCII SDK 8 62 使 OpenSSL [](http://doc.shengwang.cn/doc/rtc/javascript/advanced-features/channel-encryption)。
* @param salt `"aes-128-gcm2"` `"aes-256-gcm2"` 使 OpenSSL [](http://doc.shengwang.cn/doc/rtc/javascript/advanced-features/channel-encryption)。
* @param encryptDataStream `"aes-128-gcm2"` `"aes-256-gcm2"` 使
* - `true`:
* - `false`:
*/
setEncryptionConfig(encryptionMode: EncryptionMode, secret: string, salt?: Uint8Array, encryptDataStream?: boolean): void;
/**
* token
*
* token token [AgoraRTCClient.on("token-privilege-will-expire")]{@link event_token_privilege_will_expire} , token SDK
* @param token token
*/
renewToken(token: string): Promise<void>;
/**
*
*
* SDK
*
* SDK [AgoraRTCClient.on("volume-indicator")]{@link event_volume_indicator}
*
* > `enableAudioVolumeIndicator`
*
* ```javascript
* client.enableAudioVolumeIndicator();
* client.on("volume-indicator", volumes => {
* volumes.forEach((volume, index) => {
* console.log(`${index} UID ${volume.uid} Level ${volume.level}`);
* });
* })
* ```
*/
enableAudioVolumeIndicator(): void;
/**
*
*
* @returns
*/
getRTCStats(): AgoraRTCStats;
/**
*
*
*
*
* > 使[](https://doc.shengwang.cn/doc/media-push/restful/overview/product-overview)。
*
* @param config {@link LiveStreamingTranscodingConfig}
* @category Live Streaming
*/
setLiveTranscoding(config: LiveStreamingTranscodingConfig): Promise<void>;
/**
* CDN
*
* [ CDN](https://docs.agora.io/cn/Interactive%20Broadcast/cdn_streaming_web_ng)。
*
* >
* > -
*
* ```javascript
* await client.setLiveTranscoding(config);
* await client.startLiveStreaming("rtmp://xxxx", true);
* ```
* @param url ASCII RTMP
* @param transcodingEnabled () RTMP `true` [setLiveTranscoding]{@link IAgoraRTCClient.setLiveTranscoding}
* - `true`: [setLiveTranscoding]{@link IAgoraRTCClient.setLiveTranscoding}
* - `false`:
* @category Live Streaming
*/
startLiveStreaming(url: string, transcodingEnabled?: boolean): Promise<void>;
/**
*
*
*
*
* @param url -
* @category Live Streaming
*/
stopLiveStreaming(url: string): Promise<void>;
/**
*
*
* SDK
* - [AgoraRTCClient.on("channel-media-relay-state")]{@link event_channel_media_relay_state}
* - `state` 3`code`
* - [AgoraRTCClient.on("channel-media-relay-event")]{@link event_channel_media_relay_event}
* - `code` 4.
*
* >
* > - sales@shengwang.cn
* > - String UID
* > -
* > -
* > - {@link stopChannelMediaRelay} 退
*
* ```javascript
* client.startChannelMediaRelay(config).then(() => {
* console.log("startChannelMediaRelay success");
* }).catch(e => {
* console.log("startChannelMediaRelay failed", e);
* })
* ```
* @param config - [ChannelMediaRelayConfiguration]{@link IChannelMediaRelayConfiguration}
* @returns Promise Promise resolve
* @category Channel Media Relay
*/
startChannelMediaRelay(config: IChannelMediaRelayConfiguration): Promise<void>;
/**
*
*
*
*
* >
* > - {@link startChannelMediaRelay}
* > - 4
*
* @param config - [ChannelMediaRelayConfiguration]{@link IChannelMediaRelayConfiguration}
* @returns Promise Promise resolve {@link startChannelMediaRelay}
* @category Channel Media Relay
*/
updateChannelMediaRelay(config: IChannelMediaRelayConfiguration): Promise<void>;
/**
*
*
* 退
*
* @returns Promise Promise resolve
* @category Channel Media Relay
*/
stopChannelMediaRelay(): Promise<void>;
/**
*
*
* > - 5s 20
*
* @param reports
*
* ```js
* client.sendCustomReportMessage({
* reportId: "id1", category: "category1", event: "custom", label: "label1", value: 0,
* }).then(() => {
* console.log("send custom report success");
* }).catch(e => {
* console.error("send custom report error");
* });
* ```
*/
sendCustomReportMessage(reports: EventCustomReportParams[] | EventCustomReportParams): Promise<void>;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.1.0*
*
*
*
*/
getLocalAudioStats(): LocalAudioTrackStats;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.1.0*
*
*
*
* > Note: 统计信息需要在订阅远端流后进行计算 0-3
*
*/
getRemoteAudioStats(): {
[uid: string]: RemoteAudioTrackStats;
};
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.2.0*
*
*
*
*/
getRemoteNetworkQuality(): {
[uid: string]: NetworkQuality;
};
/**
*
*
* > iOS 14.4 `encodeDelay`
*
*/
getLocalVideoStats(): LocalVideoTrackStats;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.1.0*
*
*
*
* > Note: 统计信息需要在订阅远端流后进行计算 0-3
*
*/
getRemoteVideoStats(): {
[uid: string]: RemoteVideoTrackStats;
};
/**
*
*
*
* SDK [InspectConfiguration]{@link InspectConfiguration}
* HTTPS [](https://doc.shengwang.cn/doc/rtc/javascript/advanced-features/content-inspect)。
*
* > SDK 1000 /
*
* ```javascript
* client.enableContentInspect({
* // 设置每 5000ms 对本地视频轨道截一次图
* interval:5000,
* // 设置第三方云存储地址的前缀
* ossFilePrefix:`${channelName}/${uid}`,
* // 设置附加信息,附加信息随截图一起发送给你的服务器
* extraInfo:"fromAgora",
* })
* ```
*
* @param inspectConfig
*/
enableContentInspect(inspectConfig: InspectConfiguration): Promise<void>;
/**
*
*
*/
disableContentInspect(): Promise<void>;
/**
*
*
* @param enabled `false` `false`
*/
setImageModeration(enabled: false): Promise<void>;
/**
*
*
* SDK [image-moderation-connection-state-change]{@link event_image_moderation_connection_state_change}
*
* > -
* > -
* > -
*
* @param enabled `true` `true`
* @param config {@link ImageModerationConfiguration}
*/
setImageModeration(enabled: true, config: ImageModerationConfiguration): Promise<void>;
/**
* @ignore
*/
setLicense(license: string): void;
/**
*
* @自从
* <br>&emsp;&emsp;&emsp;*4.16.0*
*
*
*
* Agora Web SDK 访
* [sales@shengwang.cn](mailto:sales@shengwang.cn)
*
* > Note:
* > - 使 {@link startProxyServer}
* > - SDK SD-RTN TCP/TLS 443 `join-fallback-to-proxy`
* > - [Chrome ](https://bugs.chromium.org/p/chromium/issues/detail?id=1290390),使用该接口过程中 Chrome 控制台可能会误报错误信息提示,开发者可以忽略。
*
* ```javascript
* client.setLocalAccessPointsV2({
* accessPoints: {
* serverList:["192.168.1.1","192.168.2.2"],
* domain: 'test.agora.io'
* },
* log:{
* hostname:["abc.com"],
* port: 3000
* },
* report:{
* hostname:["example.com"],
* port: 8080
* }
* })
* ```
*
* @param config {@link LocalAccessPointConfig}
*/
setLocalAccessPointsV2(config: LocalAccessPointConfig): void;
}
/**
* AgoraSDK
* @ignore
*/
export declare interface IAgoraRTCError extends Error {
readonly code: AgoraRTCErrorCode;
readonly message: string;
readonly data?: any;
readonly name: string;
toString(): string;
print(level?: "error" | "warning", logger?: any): IAgoraRTCError;
throw(logger?: any): never;
}
/**
* [AgoraRTCClient.remoteUsers]{@link IAgoraRTCClient.remoteUsers} [AgoraRTCClient.on("user-joined")]{@link IAgoraRTCClient.event_user_joined}
*
* ID
*
* [AgoraRTCClient.subscribe]{@link subscribe} [audioTrack]{@link IAgoraRTCRemoteUser.audioTrack} [videoTrack]{@link IAgoraRTCRemoteUser.videoTrack}
* @public
*/
export declare interface IAgoraRTCRemoteUser {
/**
* ID
*/
uid: UID;
/**
*
*/
audioTrack?: IRemoteAudioTrack;
/**
*
*/
videoTrack?: IRemoteVideoTrack;
/**
*
* - `true`:
* - `false`:
*/
hasAudio: boolean;
/**
*
* - `true`:
* - `false`:
*/
hasVideo: boolean;
/**
* @ignore
*/
dataChannels?: IRemoteDataChannel[];
}
/**
* [LocalAudioTrack]{@link ILocalAudioTrack}, //
*
* [AgoraRTC.createBufferSourceAudioTrack]{@link IAgoraRTC.createBufferSourceAudioTrack}
*/
export declare interface IBufferSourceAudioTrack extends ILocalAudioTrack {
/**
* [source]{@link BufferSourceAudioTrackInitConfig.source}
*/
source: string | File | AudioBuffer | null;
/**
* //
*/
currentState: AudioSourceState;
/**
*
*/
duration: number;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.18.0*
*
* [50,400]
* - `50`: 0.5
* - `100`:
* - `400`: 4
*/
playbackSpeed: number;
/**
* @param event
* @param listener [source-state-change]{@link event_source_state_change}
*/
on(event: "source-state-change", listener: typeof event_source_state_change): void;
/**
*
* @param event
* @param listener
*/
on(event: string, listener: Function): void;
/**
*
*
* @returns
*/
getCurrentTime(): number;
/**
*
*
* > SDK
* > [[play]]
*
* @param options / [[AudioSourceOptions]]
*/
startProcessAudioBuffer(options?: AudioSourceOptions): void;
/**
*
*/
pauseProcessAudioBuffer(): void;
/**
*
*
* @param time
*/
seekAudioBuffer(time: number): void;
/**
*
*/
resumeProcessAudioBuffer(): void;
/**
*
*/
stopProcessAudioBuffer(): void;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.18.0*
*
*
*
*
*
* @param speed [50,400]
* - `50`: 0.5
* - `100`:
* - `400`: 4
*/
setAudioBufferPlaybackSpeed(speed: number): void;
}
/**
* [LocalVideoTrack]{@link ILocalVideoTrack}/
*
* [AgoraRTC.createCameraVideoTrack]{@link IAgoraRTC.createCameraVideoTrack}
*/
export declare interface ICameraVideoTrack extends ILocalVideoTrack {
/**
*
*
* >
*
* @param deviceId ID
* - [AgoraRTC.getCameras]{@link IAgoraRTC.getCameras} `deviceId`
* - 4.19.0 `facingMode` `deviceId` `deviceId` [AgoraRTC.getCameras]{@link IAgoraRTC.getCameras} `facingMode`
* - `"environment"`: 使
* - `"user"`: 使
*/
setDevice(deviceId: string | RequiredOnlyOneOf<{
facingMode: VideoFacingModeEnum;
deviceId: string;
}>): Promise<void>;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.0.0*
*
* /
*
*
*
* > - [LocalTrack.on("track-ended")]{@link event_track_ended}
* > - [user-unpublished]{@link IAgoraRTCClient.event_user_unpublished} [user-published]{@link IAgoraRTCClient.event_user_published}
* > - `setEnabled` `setMuted`
*
* @param enabled :
* - `true`: .
* - `false`: .
*/
setEnabled(enabled: boolean): Promise<void>;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.19.0*
*
*
*
* 线
*
* @param config [[VideoEncoderConfiguration]] SDK [[VideoEncoderConfigurationPreset]]
* @param cloneTrack `true`
* @returns
*/
clone(config?: VideoEncoderConfiguration | VideoEncoderConfigurationPreset, cloneTrack?: boolean): ICameraVideoTrack;
}
/**
*
*
* [startChannelMediaRelay]{@link IAgoraRTCClient.startChannelMediaRelay} [updateChannelMediaRelay]{@link IAgoraRTCClient.updateChannelMediaRelay}
*
* ```javascript
* const configuration = AgoraRTC.createChannelMediaRelayConfiguration();
* configuration.setSrcChannelInfo({ channelName: "test", token: "xxx", uid: 12345 });
* configuration.addDestChannelInfo({ channelName: "test2", token: "xxx", uid: 23456 });
* ```
*/
export declare interface IChannelMediaRelayConfiguration {
/**
*
*
* ```javascript
* const config = AgoraRTC.createChannelMediaRelayConfiguration();
* config.setSrcChannelInfo({ channelName: "test", token: "xxx", uid: 123456 });
* ```
* @param info - [ChannelMediaRelayInfo]{@link ChannelMediaRelayInfo}
*/
setSrcChannelInfo(info: ChannelMediaRelayInfo): void;
/**
*
*
* 4
*
* ```javascript
* const config = AgoraRTC.createChannelMediaRelayConfiguration();
* config.addDestChannelInfo({ channelName: "test2", token: "xxx", uid: 23456 });
* config.addDestChannelInfo({ channelName: "test3", token: "xxx", uid: 23457 });
* ```
*
* @param info - [ChannelMediaRelayInfo]{@link ChannelMediaRelayInfo}
*/
addDestChannelInfo(info: ChannelMediaRelayInfo): void;
/**
* {@link addDestChannelInfo}
*
* @param channelName -
*/
removeDestChannelInfo(channelName: string): void;
}
/** @ignore */
export declare interface IDataChannel extends EventEmitter {
readonly id: number;
readonly maxRetransmits: number | null;
readonly ordered: boolean;
readonly readyState: RTCDataChannelState;
readonly metadata: string;
getChannelId(): number;
getConfig(): IDataChannelConfig;
}
/** @ignore */
export declare interface IDataChannelConfig {
id: number;
/**
* RTCDataChannel (true), (false). true.
*/
ordered: boolean;
/**
* 0~512
*/
metadata: string;
}
/**
* @ignore
*/
declare interface IElectronNativeImage {
toDataURL(): string;
getSize(): {
width: number;
height: number;
};
resize(options: {
width: number;
}): IElectronNativeImage;
}
/**
*
*
* [AgoraRTC.createCustomAudioTrack]{@link IAgoraRTC.createCustomAudioTrack}
*
* - [MicrophoneAudioTrack]{@link IMicrophoneAudioTrack}
* - [BufferSourceAudioTrack]{@link IBufferSourceAudioTrack}
*/
export declare interface ILocalAudioTrack extends ILocalTrack {
/**
*
* @param volume [0, 1000], 0 100 100 使 WebAudio
*/
setVolume(volume: number): void;
/**
*
*
* @returns [0, 1]1 0.6
*/
getVolumeLevel(): number;
/**
* PCM
*
* SDK [AudioBuffer](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer) 的形式通过回调返回。
*
* > `frameSize` `frameSize`
*
* ```js
* track.setAudioFrameCallback((buffer) => {
* for (let channel = 0; channel < buffer.numberOfChannels; channel += 1) {
* // Float32Array with PCM data
* const currentChannelData = buffer.getChannelData(channel);
* console.log("PCM data in channel", channel, currentChannelData);
* }
* }, 2048);
*
* // ....
* // Stop getting the raw audio data
* track.setAudioFrameCallback(null);
* ```
*
* @param audioFrameCallback [AudioBuffer](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer) 的回调函数。设为 `null` 后SDK 就会停止获取音频原始数据。
* @param frameSize `AudioBuffer` 256, 512, 1024, 2048, 4096, 8192, 16384 4096
*/
setAudioFrameCallback(audioFrameCallback: null | ((buffer: AudioBuffer) => void), frameSize?: number): void;
/**
*
*
* > SDK DOM DOM
*/
play(): void;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.1.0*
*
* >
* > - v4.7.0 [IRemoteAudioTrack.setPlaybackDevice]{@link IRemoteAudioTrack.setPlaybackDevice}
*
*
*
* @param deviceId ID [[getPlaybackDevices]]
*/
setPlaybackDevice(deviceId: string): Promise<void>;
/**
*
*
* @deprecated
* v4.1.0 使 [AgoraRTCClient.getLocalVideoStats]{@link IAgoraRTCClient.getLocalVideoStats} [AgoraRTCClient.getLocalAudioStats]{@link IAgoraRTCClient.getLocalAudioStats}
*/
getStats(): LocalAudioTrackStats;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.10.0*
*
* `Processor`
* @param processor `Processor` `Processor`
*
* @returns `Processor`
*/
pipe(processor: IAudioProcessor): IAudioProcessor;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.10.0*
*
* `Processor`
*/
unpipe(): void;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.10.0*
*
*
*/
processorDestination: IAudioProcessor;
}
/** @ignore */
export declare interface ILocalDataChannel extends IDataChannel {
send(data: ArrayBuffer): void;
}
/**
* `LocalTrack` [LocalAudioTrack]{@link ILocalAudioTrack} [LocalVideoTrack]{@link ILocalVideoTrack}
*
*/
export declare interface ILocalTrack extends ITrack {
/**
* @param event
* @param listener [track-updated]{@link event_track_updated}
*/
on(event: "track-updated", listener: typeof event_track_updated): void;
/**
* @param event
* @param listener [track-ended]{@link event_track_ended}
*/
on(event: "track-ended", listener: typeof event_track_ended): void;
/**
*
* @param event
* @param listener [ILocalTrack.transceiver-updated]{@link event_transceiver_updated}
*/
on(event: "transceiver-updated", listener: typeof event_transceiver_updated): void;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.0.0*
*
* /
*
*
*
* > - [LocalTrack.on("track-ended")]{@link event_track_ended}
* > - [user-unpublished]{@link IAgoraRTCClient.event_user_unpublished} [user-published]{@link IAgoraRTCClient.event_user_published}
* > - `setEnabled` `setMuted`
*
* @param enabled :
* - `true`:
* - `false`:
*/
setEnabled(enabled: boolean): Promise<void>;
/**
* @deprecated
* v4.1.0 使 [AgoraRTCClient.getLocalVideoStats]{@link IAgoraRTCClient.getLocalVideoStats} [AgoraRTCClient.getLocalAudioStats]{@link IAgoraRTCClient.getLocalAudioStats}
*
*
*
* > iOS `encodeDelay`
*/
getStats(): LocalVideoTrackStats | LocalAudioTrackStats;
/**
*
*
* @return
* - `createMicrophoneAudioTrack` `createCameraVideoTrack` [MediaDeviceInfo.label](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo/label) 字段。
* - `createScreenVideoTrack` `sourceId`
* - `createCustomAudioTrack` `createCustomVideoTrack` [MediaStreamTrack.label](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack/label) 字段。
*/
getTrackLabel(): string;
/**
*
*
* @自从
* <br>&emsp;&emsp;&emsp;*4.6.0*
*
* `setMuted(true)` [user-unpublished]{@link IAgoraRTCClient.event_user_unpublished} `setMuted(false)` [user-published]{@link IAgoraRTCClient.event_user_published}
*
* > - {@link setEnabled} [setEnabled setMuted ](http://doc.shengwang.cn/faq/integration-issues/diff-setenabled-setmuted)。
* > - `setEnabled` `setMuted`
*
* @param muted :
* - `true`:
* - `false`:
*/
setMuted(muted: boolean): Promise<void>;
/**
*
*
* 使使
*/
close(): void;
/**
*
*/
muted: boolean;
/**
*
*/
enabled: boolean;
}
/**
* `LocalVideoTrack`
*
* [AgoraRTC.createCustomVideoTrack]{@link IAgoraRTC.createCustomVideoTrack} [AgoraRTC.createScreenVideoTrack]{@link IAgoraRTC.createScreenVideoTrack} `LocalVideoTrack`
*
* [CameraVideoTrack]{@link ICameraVideoTrack}
*/
export declare interface ILocalVideoTrack extends ILocalTrack {
/**
* @param event
* @param listener [track-updated]{@link event_track_updated}
*/
on(event: "track-updated", listener: typeof event_track_updated): void;
/**
* @param event
* @param listener [track-ended]{@link event_track_ended}
*/
on(event: "track-ended", listener: typeof event_track_ended): void;
/**
* @param event
* @param listener [video-element-visible-status]{@link event_video_element_visible_status}
*/
on(event: "video-element-visible-status", listener: typeof event_video_element_visible_status): void;
/**
*
* @param event
* @param listener [ILocalTrack.transceiver-updated]{@link event_transceiver_updated}
*/
on(event: "transceiver-updated", listener: typeof event_transceiver_updated): void;
/**
*
*
* @param element DOM SDK `<video>` 2
* - `string`: DOM ID
* - `HTMLElement`: DOM
* @param config / [[VideoPlayerConfig]]
*/
play(element: string | HTMLElement, config?: VideoPlayerConfig): void;
/**
*
*
* @deprecated
* v4.1.0 使 [AgoraRTCClient.getLocalVideoStats]{@link IAgoraRTCClient.getLocalVideoStats} [AgoraRTCClient.getLocalAudioStats]{@link IAgoraRTCClient.getLocalAudioStats}
*
*/
getStats(): LocalVideoTrackStats;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.19.0*
*
*
*
* 线
*
* @param config [[VideoEncoderConfiguration]] SDK [[VideoEncoderConfigurationPreset]]
* @param cloneTrack `true`
* @returns
*/
clone(config?: VideoEncoderConfiguration | VideoEncoderConfigurationPreset, cloneTrack?: boolean): ILocalVideoTrack;
/**
* @ignore
*
*
*
* >
* > - SDK [使](https://docs.agora.io/cn/Video/beauty_effect_web_ng?platform=Web)。
* > -
* > - Safari 12
* > - Chrome 65
* > - Firefox 70.0.1
* > -
* > -
*
* @param enabled
* - `true`:
* - `false`:
* @param options [[BeautyEffectOptions]]
*/
setBeautyEffect(enabled: boolean, options?: BeautyEffectOptions): Promise<void>;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.1.0*
*
*
*
* > [[play]]
*
* @returns RGBA `ImageData` [ImageData](https://developer.mozilla.org/zh-CN/docs/Web/API/ImageData)。
*/
getCurrentFrameData(): ImageData;
/**
* @ignore
*/
getCurrentFrameImage(imageType: string, quality: number): Promise<ImageTypedData>;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.2.0*
*
*
*
* 稿 `"detail"` `"motion"`
*
* > Chrome
*
* @param mode
* - `"balanced"`: 使
* - SDK
* - SDK
* - `"detail"`:
* - SDK 使
* - SDK
* - `"motion"`: 4.21.0 SDK
* - SDK
* - SDK
*/
setOptimizationMode(mode: "balanced" | "motion" | "detail"): Promise<void>;
/**
* * @自从
* <br>&emsp;&emsp;&emsp;*4.8.0*
*
* HTML `<video>`
*
* `localVideoTrack.play` SDK [HTML `<video>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video) 标签用于播放视频轨道。当 `localVideoTrack.isPlaying` 为 `true` 却看不到图像时,你可调用该方法进行问题排查。
*
* @returns [[CheckVideoVisibleResult]] `undefined`
* - `localVideoTrack.isPlaying` `false`
* - `<video>`
* - `<video>` `play`
*/
getVideoElementVisibleStatus(): CheckVideoVisibleResult | undefined;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.10.0*
*
* `Processor`
* @param processor `Processor` `Processor`
*
* @returns `Processor`
*/
pipe(processor: IBaseProcessor): IBaseProcessor;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.10.0*
*
* `Processor`
*/
unpipe(): void;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.10.0*
*
*
*/
processorDestination: IBaseProcessor;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.17.0*
*
*
*
*
* -
* -
*
* {@link ILocalVideoTrack.getMediaStreamTrack} `mediaStream.getVideoTracks`
*
* >
* > - Chrome 65+Safari Firefox
* > -
* > -
* > - `ScreenVideoTrack` `CameraVideoTrack` `CameraVideoTrack` {@link VideoPlayerConfig.mirror}
* > - `encoderConfig`
* > -
* > - 使 {@link ICameraVideoTrack.setDevice}
*
* ****
* ```javascript
* // 原有的本地视频轨道
* const localVideoTrack = await AgoraRTC.createCameraVideoTrack();
* // 获取新的视频轨道(方式一)
* const newTrack = localVideoTrack.getMediaStreamTrack();
* // 获取新的视频轨道(方式二)
* const newTrack = await navigator.mediaDevices.getUserMedia({audio: true, video: true}).then(mediaStream => mediaStream.getVideoTracks()[0]);
* // 替换本地视频轨道,并且停止原有的视频轨道
* await localVideoTrack.replaceTrack(newTrack, true);
* ```
*
* @param track [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack) 对象。
* @param stopOldTrack
* -
* -
*/
replaceTrack(track: MediaStreamTrack, stopOldTrack: boolean): Promise<void>;
/**
*
*
* @param config SDK [[VideoEncoderConfigurationPreset]] [[VideoEncoderConfiguration]]
*/
setEncoderConfiguration(config: VideoEncoderConfiguration | VideoEncoderConfigurationPreset): Promise<void>;
/**
* H.264 SEI
*
* @param sei SEI
*/
sendSeiData(sei: Uint8Array): void;
}
/**
* {@link setImageModeration}
*/
declare interface ImageModerationConfiguration {
/**
* (ms) `1000`
*/
interval: number;
/**
* 1024
*
* SDK
*/
extraInfo?: string;
/**
* @ignore
*
*
*/
vendor?: string;
}
/**
* SDK
*/
declare enum ImageModerationConnectionState {
/** SDK 正在连接该服务。 */
CONNECTING = "CONNECTING",
/** SDK 正在重新连接该服务。 */
RECONNECTING = "RECONNECTING",
/** SDK 已连接该服务。 */
CONNECTED = "CONNECTED",
/** SDK 断开与该服务的连接。 */
CLOSED = "CLOSED"
}
export declare interface ImageTypedData {
buffer: Uint8Array;
width: number;
height: number;
}
/**
* [LocalAudioTrack]{@link ILocalAudioTrack}
*
* [AgoraRTC.createMicrophoneAudioTrack]{@link IAgoraRTC.createMicrophoneAudioTrack}
*/
export declare interface IMicrophoneAudioTrack extends ILocalAudioTrack {
/**
*
*
* >
*
* @param deviceId Id [AgoraRTC.getMicrophones]{@link IAgoraRTC.getMicrophones}
*/
setDevice(deviceId: string): Promise<void>;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.0.0*
*
* /
*
*
*
* > - [LocalTrack.on("track-ended")]{@link event_track_ended}
* > - [user-unpublished]{@link IAgoraRTCClient.event_user_unpublished} [user-published]{@link IAgoraRTCClient.event_user_published}
* > - `setEnabled` `setMuted`
*
* @param enabled :
* - `true`: .
* - `false`: .
*/
setEnabled(enabled: boolean): Promise<void>;
}
/**
* [enableContentInspect]{@link IAgoraRTCClient.enableContentInspect}
* @public
*/
export declare interface InspectConfiguration {
/**
* ms `1000` `1000`SDK `1000`
*/
interval: number;
/**
*
*/
ossFilePrefix?: string;
/**
* 1024
*
* SDK
*/
extraInfo?: string;
/**
*
*
* 使 `supervise`SDK
*/
inspectType?: ("supervise" | "moderation")[];
}
/**
*
*/
declare enum InspectState {
/** SDK 正在连接该服务。 */
CONNECTING = "CONNECTING",
/** SDK 正在重新连接该服务。 */
RECONNECTING = "RECONNECTING",
/** SDK 已连接该服务。 */
CONNECTED = "CONNECTED",
/** SDK 断开与该服务的连接。 */
CLOSED = "CLOSED"
}
/**
* [subscribe]{@link IAgoraRTCClient.subscribe} [AgoraRTCRemoteUser.audioTrack]{@link IAgoraRTCRemoteUser.audioTrack}
*/
export declare interface IRemoteAudioTrack extends IRemoteTrack {
/**
*
*
* **使** 使 [AgoraRTCClient.getRemoteAudioStats]{@link IAgoraRTCClient.getRemoteAudioStats}
*
* @return [[RemoteAudioTrackStats]]
*/
getStats(): RemoteAudioTrackStats;
/**
*
*
* > SDK DOM DOM
*/
play(): void;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.1.0*
*
*
*
* > Chrome Edge `NOT_SUPPORTED`
* @param deviceId ID [[getPlaybackDevices]]
*/
setPlaybackDevice(deviceId: string): Promise<void>;
/**
* PCM
*
* SDK [AudioBuffer](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer) 的形式通过回调返回。
*
* > `frameSize` `frameSize`
*
* ```js
* track.setAudioFrameCallback((buffer) => {
* for (let channel = 0; channel < buffer.numberOfChannels; channel += 1) {
* // Float32Array with PCM data
* const currentChannelData = buffer.getChannelData(channel);
* console.log("PCM data in channel", channel, currentChannelData);
* }
* }, 2048);
*
* // ....
* // Stop getting the raw audio data
* track.setAudioFrameCallback(null);
* ```
*
* @param audioFrameCallback [AudioBuffer](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer) 的回调函数。设为 `null` 后SDK 就会停止获取音频原始数据。
* @param frameSize `AudioBuffer` 256, 512, 1024, 2048, 4096, 8192, 16384 4096
*/
setAudioFrameCallback(audioFrameCallback: null | ((buffer: AudioBuffer) => void), frameSize?: number): void;
/**
*
* @param volume [0, 100]0 100
*/
setVolume(volume: number): void;
/**
*
*
* @returns [0, 1]1 0.6
*/
getVolumeLevel(): number;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.13.0*
*
* `Processor`
*
* @param processor `Processor` `Processor`
*
* @returns `Processor`
*/
pipe(processor: IAudioProcessor): IAudioProcessor;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.13.0*
*
* `Processor`
*/
unpipe(): void;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.13.0*
*
*
*/
processorDestination: IAudioProcessor;
}
/** @ignore */
export declare interface IRemoteDataChannel extends IDataChannel {
}
/**
* [RemoteAudioTrack]{@link IRemoteAudioTrack} [RemoteVideoTrack]{@link IRemoteVideoTrack}
*/
export declare interface IRemoteTrack extends ITrack {
/**
* @param event
* @param listener [track-updated]{@link event_track_updated}
*/
on(event: "track-updated", listener: typeof event_track_updated): void;
/**
* @param event
* @param listener [first-frame-decoded]{@link event_first_frame_decoded}
*/
on(event: "first-frame-decoded", listener: typeof event_first_frame_decoded): void;
/**
*
* @param event
* @param listener [IRemoteTrack.transceiver-updated]{@link event_transceiver_updated_2}
*/
on(event: "transceiver-updated", listener: typeof event_transceiver_updated_2): void;
/**
* ID
*
* @return `uid`
*/
getUserId(): UID;
/**
*
*
* @deprecated
*
* v4.1.0 使 [AgoraRTCClient.getRemoteVideoStats]{@link IAgoraRTCClient.getRemoteVideoStats} [AgoraRTCClient.getRemoteAudioStats]{@link IAgoraRTCClient.getRemoteAudioStats}
* @return [[RemoteAudioTrackStats]] [[RemoteVideoTrackStats]]
*/
getStats(): RemoteAudioTrackStats | RemoteVideoTrackStats;
}
/**
*
*
* [subscribe]{@link IAgoraRTCClient.subscribe} [AgoraRTCRemoteUser.videoTrack]{@link IAgoraRTCRemoteUser.videoTrack}
*/
export declare interface IRemoteVideoTrack extends IRemoteTrack {
/**
* @param event
* @param listener [track-updated]{@link event_track_updated}
*/
on(event: "track-updated", listener: typeof event_track_updated): void;
/**
* @param event
* @param listener [video-state-changed]{@link event_video_state_changed}
*/
on(event: "video-state-changed", listener: typeof event_video_state_changed): void;
/**
* @param event
* @param listener [first-frame-decoded]{@link event_first_frame_decoded}
*/
on(event: "first-frame-decoded", listener: typeof event_first_frame_decoded): void;
/**
* @param event
* @param listener [video-element-visible-status]{@link event_video_element_visible_status_2}
*/
on(event: "video-element-visible-status", listener: typeof event_video_element_visible_status_2): void;
/**
*
* @param event
* @param listener [IRemoteTrack.transceiver-updated]{@link event_transceiver_updated_2}
*/
on(event: "transceiver-updated", listener: typeof event_transceiver_updated_2): void;
/**
*
* @param event
* @param listener [ILocalTrack.sei-received]{@link event_sei_received}
*/
on(event: "sei-received", listener: typeof event_sei_received): void;
/**
*
*
* **使** 使 [AgoraRTCClient.getRemoteVideoStats]{@link IAgoraRTCClient.getRemoteVideoStats}
*
* @return [[RemoteVideoTrackStats]]
*/
getStats(): RemoteVideoTrackStats;
/**
*
* @param element DOM SDK `<video>` 2
* - `string`: DOM ID
* - `HTMLElement`: DOM
* @param config / [[VideoPlayerConfig]]
*/
play(element: string | HTMLElement, config?: VideoPlayerConfig): void;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.1.0*
*
*
*
* > [[play]]
*
* @returns RGBA `ImageData` [ImageData](https://developer.mozilla.org/zh-CN/docs/Web/API/ImageData)。
*/
getCurrentFrameData(): ImageData;
/**
* * @自从
* <br>&emsp;&emsp;&emsp;*4.8.0*
*
* HTML `<video>`
*
* `remoteVideoTrack.play` SDK [HTML `<video>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video) 标签用于播放视频轨道。当 `remoteVideoTrack.isPlaying` 为 `true` 却看不到图像时,你可调用该方法进行问题排查。
*
* @return [[CheckVideoVisibleResult]] `undefined`
* - `remoteVideoTrack.isPlaying` `false`
* - `<video>`
* - `<video>` `play`
*/
getVideoElementVisibleStatus(): CheckVideoVisibleResult | undefined;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.13.0*
*
* `Processor`
*
* @param processor `Processor` `Processor`
*
* @returns `Processor`
*/
pipe(processor: IBaseProcessor): IBaseProcessor;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.13.0*
*
* `Processor`
*/
unpipe(): void;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.13.0*
*
*
*/
processorDestination: IBaseProcessor;
}
/**
* @ignore
*/
export declare interface ITrack extends EventEmitter {
/**
*
* - `"audio"`:
* - `"video"`:
*/
trackMediaType: "audio" | "video";
/**
*
* - `true`:
* - `false`:
*/
isPlaying: boolean;
/**
* SDK ID
*
* @return ID
*/
getTrackId(): string;
/**
* [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack) 对象。
*
* @return [MediaStreamTrack](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack) 对象。
*/
getMediaStreamTrack(): MediaStreamTrack;
/**
* [RTCRtpTransceiver](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpTransceiver) 实例。
*
* [Beta](https://doc.shengwang.cn/doc/rtc/javascript/advanced-features/e2e-encryption)。
*
* > SDK 线 `RTCRtpTransceiver` `RTCRtpTransceiver`
* > - [ILocalTrack.transceiver-updated]{@link event_transceiver_updated}
* > - [IRemoteTrack.transceiver-updated]{@link event_transceiver_updated_2}
*
* @param type {@link StreamType}
* @returns `RTCRtpTransceiver`
*/
getRTCRtpTransceiver(type?: StreamType): RTCRtpTransceiver | undefined;
/**
*
*
* @param element DOM SDK `<video>` 2
* - `string`: DOM ID
* - `HTMLElement`: DOM
*/
play(element?: string | HTMLElement): void;
/**
*
*/
stop(): void;
}
/**
* CDN [AgoraRTCClient]{@link IAgoraRTCClient.setLiveTranscoding} 使
* @public
*/
export declare interface LiveStreamingTranscodingConfig {
/**
* Kbps
*
* 48 128
*/
audioBitrate?: number;
/**
*
*
* 1 2 345
* - 1:
* - 2: 双声道
* - 3: 三声道
* - 4: 四声道
* - 5: 五声道
*/
audioChannels?: 1 | 2 | 3 | 4 | 5;
/**
*
*
* - 32000: 音频采样率 32 kHz
* - 44100: 音频采样率 44.1 kHz
* - 48000: 48 kHz
*/
audioSampleRate?: 32000 | 44100 | 48000;
/**
*
*
* 0x000000 16
*/
backgroundColor?: number;
/**
* 360
* - `height` 64 64
* - `width` `height` 0
*/
height?: number;
/**
* 640
*
* - `width` 64 64
* - `width` `height` 0
*/
width?: number;
/**
* @ignore
*
*
* @deprecated
*
* 使
* - `true`:
* - `false`:
*/
lowLatency?: boolean;
/**
* Kbps 400
*/
videoBitrate?: number;
/**
*
*
* `66``77` `100` `100`
* - `66`: Baseline
* - `77`: Main MP4便PSP iPad
* - `100`:High 广
*/
videoCodecProfile?: 66 | 77 | 100;
/**
* fps 15
*
* 30 30
*/
videoFrameRate?: number;
/**
* GOP 30
*/
videoGop?: number;
/**
* @deprecated
*
*
*
* 使 [LiveStreamingTranscodingConfig.watermark]{@link LiveStreamingTranscodingConfig.watermark}
*
* >
*/
images?: LiveStreamingTranscodingImage[];
/**
*
*
*/
watermark?: LiveStreamingTranscodingImage;
/**
*
*
*/
backgroundImage?: LiveStreamingTranscodingImage;
/**
*
*
* 17
*/
transcodingUsers?: LiveStreamingTranscodingUser[];
/**
* H264/H265 SEI 4096 SEI [SEI ](https://docs.agora.io/cn/faq/sei)。
*/
userConfigExtraInfo?: string;
}
/**
* [LiveStreamingTranscodingConfig]{@link LiveStreamingTranscodingConfig}
* @public
*/
export declare interface LiveStreamingTranscodingImage {
/**
* 线 PNG
*/
url: string;
/**
*
*
* `0`
*/
x?: number;
/**
*
*
* `0`
*/
y?: number;
/**
*
*
* 160
*/
width?: number;
/**
*
*
* 160
*/
height?: number;
/**
*
*
* [0.0,1.0]:
* - 0.0: 图片完全透明
* - 1.0:
*/
alpha?: number;
}
/**
* [LiveStreamingTranscodingConfig]{@link LiveStreamingTranscodingConfig} CDN
* @public
*/
export declare interface LiveStreamingTranscodingUser {
/**
* , [0.0,1.0]
*
* - 0.0: 该区域图像完全透明
* - 1.0:
*/
alpha?: number;
/**
* 640
*/
height?: number;
/**
* ID
*/
uid: UID;
/**
* 360
*/
width?: number;
/**
* 0
*/
x?: number;
/**
* 0
*/
y?: number;
/**
*
*
* [0,100]:
* - 0
* - 100
*/
zOrder?: number;
/**
* [0, 5] 0
* - 0
* - 1 FL
* - 2 FC
* - 3 FR
* - 4 BL
* - 5 BR
*/
audioChannel?: number;
}
/**
* / {@link setLocalAccessPointsV2}
*
* - `accessPoints`访
* - `serverList`IP hostname SDK 访 Agora SD-RTN
* - `domain` `serverList` IP SDK IP `domain` hostname `domain` SDK Agora SD-RTN
* - `port` hostname
* - `log` `hostname` `port` {@link enableLogUpload} SDK
* - `report` `hostname` `port`
* - `cds`
*
* 使
*
* |||
* |:----:|:----:|
* |`log.hostname`| `accessPoints` hostname |
* |`log.port`|6444|
* |`report.hostname`| `accessPoints` hostname |
* |`report.port`|6443|
* |`accessPoints.port`|443|
*
*
* ```javascript
* client.setLocalAccessPointsV2({
* accessPoints: {
* serverList:["192.168.1.1","192.168.2.2"],
* domain: 'test.agora.io'
* },
* // 必须先调用 enableLogUpload下面的日志服务设置才生效
* log:{
* hostname:["abc.com"],
* port: 3000
* },
* // 开启事件上报服务并配置参数
* report:{
* hostname:["example.com"],
* port: 8080
* }
* })
* ```
*
*/
export declare type LocalAccessPointConfig = {
[serve in "log" | "report" | "cds"]?: {
hostname?: string[];
port?: number;
};
} & {
accessPoints: {
serverList: string[];
domain: string;
port?: number;
};
};
/**
* [AgoraRTCClient.getLocalAudioStats]{@link IAgoraRTCClient.getLocalAudioStats}
* @public
*/
export declare interface LocalAudioTrackStats {
/**
*
*
* - `"opus"`: OPUS
* - `"aac"`: AAC
* - `"pcmu"`:
* - `"pcma"`:
* - `"g722"`:
*
* > Firefox
*/
codecType?: "opus" | "aac" | "PCMU" | "PCMA" | "G722";
/**
* [0,32767]
*
* > WebRTC-Stats [LocalAudioTrack.getVolumeLevel]{@link ILocalAudioTrack.getVolumeLevel}
*/
sendVolumeLevel: number;
/**
* (bps)
*/
sendBitrate: number;
/**
* (bytes)
*/
sendBytes: number;
/**
*
*/
sendPackets: number;
/**
*
*
* > Safari
*/
sendPacketsLost: number;
/**
* (ms)
*/
sendJitterMs: number;
/**
* (ms)
*/
sendRttMs: number;
/**
* 400ms
*/
currentPacketLossRate: number;
}
/**
* [AgoraRTCClient.getLocalVideoStats]{@link IAgoraRTCClient.getLocalVideoStats}
* @public
*/
export declare interface LocalVideoTrackStats {
/**
*
*
* - `"H264"`: H.264
* - `"VP8"`: VP8
* - `"VP9"`: VP9
* - `"AV1X"`:
* - `"AV1"`: AV1
*
* > Firefox
*/
codecType?: "H264" | "H265" | "VP8" | "VP9" | "AV1X" | "AV1";
/**
* (bytes)
*/
sendBytes: number;
/**
* fps
*
* > Firefox
*/
sendFrameRate?: number;
/**
* fps
*
* > Safari Firefox
*/
captureFrameRate?: number;
/**
*
*/
sendPackets: number;
/**
*
*
* > - Safari
* > - Firefox
*/
sendPacketsLost: number;
/**
* (ms)
*/
sendJitterMs: number;
/**
* (ms)
*/
sendRttMs: number;
/**
*
*/
sendResolutionHeight: number;
/**
*
*/
sendResolutionWidth: number;
/**
*
*/
captureResolutionHeight: number;
/**
*
*/
captureResolutionWidth: number;
/**
* ms
*/
encodeDelay?: number;
/**
* (bps)
*/
sendBitrate: number;
/**
* (bps) {@link VideoEncoderConfiguration}
*/
targetSendBitrate: number;
/**
*
*/
totalDuration: number;
/**
*
*/
totalFreezeTime: number;
/**
* 400ms
*/
currentPacketLossRate: number;
}
/**
* [setLowStreamParameter]{@link IAgoraRTCClient.setLowStreamParameter}
* @public
*/
export declare interface LowStreamParameter {
/**
*
*
* `number` `{ max: 1280, min: 720 }`
*
* [ConstrainLong]{@link ConstrainLong}
*/
width: ConstrainULong;
/**
*
*
* `number` `{ max: 720, min: 480 }`
*
* [ConstrainLong]{@link ConstrainLong}
*/
height: ConstrainULong;
/**
*
*
* `number` `{ max: 30, min: 5 }`
*
* [ConstrainLong]{@link ConstrainLong}
*/
framerate?: ConstrainULong;
/**
* Kbps
*/
bitrate?: number;
}
/**
* [AgoraRTC.createMicrophoneAudioTrack]{@link IAgoraRTC.createMicrophoneAudioTrack}
*/
export declare interface MicrophoneAudioTrackInitConfig {
/**
*
*
* [[AudioEncoderConfigurationPreset]] SDK [[AudioEncoderConfiguration]]
*
* > Firefox
*/
encoderConfig?: AudioEncoderConfiguration | AudioEncoderConfigurationPreset;
/**
*
* - `true`:
* - `false`:
*/
AEC?: boolean;
/**
*
* - `true`:
* - `false`:
*/
AGC?: boolean;
/**
*
* - `true`:
* - `false`:
*/
ANS?: boolean;
/**
* @ignore
*/
DTX?: boolean;
/**
* ID
*
* [AgoraRTC.getMicrophones]{@link IAgoraRTC.getMicrophones}
*/
microphoneId?: string;
/**
* @ignore
* WebAudio
*/
bypassWebAudio?: boolean;
}
/**
* last mile
*
* last mile
*
* - SDK [AgoraRTCClient.on("network-quality")]{@link IAgoraRTCClient.event_network_quality}
* - [AgoraRTCClient.getRemoteNetworkQuality]{@link IAgoraRTCClient.getRemoteNetworkQuality}
*
* >
* @public
*/
export declare interface NetworkQuality {
/**
*
*
*
*
* - 0: 质量未知
* - 1: 质量极好
* - 2: 用户主观感觉和极好差不多
* - 3: 用户主观感受有瑕疵但不影响沟通
* - 4: 勉强能沟通但不顺畅
* - 5: 网络质量非常差
* - 6: 网络连接断开
*/
uplinkNetworkQuality: 0 | 1 | 2 | 3 | 4 | 5 | 6;
/**
*
*
*
*
* - 0
* - 1
* - 2
* - 3
* - 4
* - 5
* - 6: 网络连接断开
*/
downlinkNetworkQuality: 0 | 1 | 2 | 3 | 4 | 5 | 6;
}
declare type OptimizationMode = "motion" | "detail";
/**
* [AgoraRTCClient.getRemoteAudioStats]{@link IAgoraRTCClient.getRemoteAudioStats}
* @public
*/
export declare interface RemoteAudioTrackStats {
/**
* ms)
*
*
*/
transportDelay: number;
/**
*
*
* - `"opus"`: OPUS
* - `"aac"`: AAC
* - `"pcmu"`:
* - `"pcma"`:
* - `"g722"`:
*
* > Firefox
*/
codecType?: "opus" | "aac" | "PCMU" | "PCMA" | "G722";
/**
* ms
*
*
*/
end2EndDelay: number;
/**
* bps
*/
receiveBitrate: number;
/**
* [0,32767]
*
* > WebRTC-Stats [RemoteAudioTrack.getVolumeLevel]{@link IRemoteAudioTrack.getVolumeLevel}
*/
receiveLevel: number;
/**
*
*/
receiveBytes: number;
/**
* (ms)
*
*
*
* > Safari Firefox
*/
receiveDelay: number;
/**
*
*/
receivePackets: number;
/**
*
*/
receivePacketsLost: number;
/**
*
*/
receivePacketsDiscarded: number;
/**
*
*/
packetLossRate: number;
/**
* 400ms内的丢包率
*/
currentPacketLossRate: number;
/**
*
*/
totalDuration: number;
/**
*
*/
totalFreezeTime: number;
/**
*
*/
freezeRate: number;
/**
*
* -1
*/
publishDuration: number;
}
/**
* 退 [setStreamFallbackOption]{@link IAgoraRTCClient.setStreamFallbackOption}
* @public
*/
export declare enum RemoteStreamFallbackType {
/** 0: 关闭回退策略,弱网时不对音视频流作回退处理。 */
DISABLE = 0,
/** 1: 在网络条件较差的情况下,自动订阅视频小流。 */
LOW_STREAM = 1,
/** 2: 网络较弱时,先尝试订阅视频小流。如果网络环境无法显示视频,则再回退到订阅纯音频流。 */
AUDIO_ONLY = 2,
/**
* ABR ,
*/
HIGH_STREAM_LAYER1 = 3,
HIGH_STREAM_LAYER2 = 4,
HIGH_STREAM_LAYER3 = 5,
HIGH_STREAM_LAYER4 = 6,
HIGH_STREAM_LAYER5 = 7,
HIGH_STREAM_LAYER6 = 8
}
/**
* [setRemoteVideoStreamType]{@link IAgoraRTCClient.setRemoteVideoStreamType} 使
* @public
*/
export declare enum RemoteStreamType {
/** 0: 高分辨率、高码率的视频大流。 */
HIGH_STREAM = 0,
/** 1: 低分辨率、低码率的视频小流。 */
LOW_STREAM = 1,
/**
* ABR
*
*/
HIGH_STREAM_LAYER1 = 4,
HIGH_STREAM_LAYER2 = 5,
HIGH_STREAM_LAYER3 = 6,
HIGH_STREAM_LAYER4 = 7,
HIGH_STREAM_LAYER5 = 8,
HIGH_STREAM_LAYER6 = 9
}
/**
* [AgoraRTCClient.getRemoteVideoStats]{@link IAgoraRTCClient.getRemoteVideoStats}
* @public
*/
export declare interface RemoteVideoTrackStats {
/**
* ms)
*
*
*/
transportDelay: number;
/**
*
*
* - `"H264"`: H.264
* - `"VP8"`: VP8
* - `"VP9"`: VP9
* - `"AV1X"`: AV1 Chrome M96
* - `"AV1"`: AV1
*
* > Firefox
*/
codecType?: "H264" | "H265" | "VP8" | "VP9" | "AV1X" | "AV1";
/**
* ms
*
*
*/
end2EndDelay: number;
/**
* bps
*/
receiveBitrate: number;
/**
* (ms)
*
*
*
* > Safari Firefox
*/
receiveDelay: number;
/**
*
*/
receiveBytes: number;
/**
* fps
*/
decodeFrameRate?: number;
/**
* fps
*/
receiveFrameRate?: number;
/**
* fps
*/
renderFrameRate?: number;
/**
*
*/
receivePackets: number;
/**
*
*/
receivePacketsLost: number;
/**
*
*/
packetLossRate: number;
/**
* 400ms内的丢包率
*/
currentPacketLossRate: number;
/**
*
*/
receiveResolutionHeight: number;
/**
*
*/
receiveResolutionWidth: number;
/**
*
*/
totalDuration: number;
/**
*
*/
totalFreezeTime: number;
/**
*
*/
freezeRate: number;
/**
*
* -1
*/
publishDuration: number;
}
declare type RequiredOnlyOneOf<T, K extends keyof T = keyof T> = {
[P in K]: {
[S in P]: T[S];
} & {
[U in keyof Omit<T, P>]?: never;
};
}[K] extends infer O ? {
[K in keyof O]: O[K];
} : never;
/**
* @ignore
* SDK [createClient]{@link createClient}
*
* SDK :
* - `timeout` 500 ms
* - `timeout`
* - `timeout` `timeoutFactor` `timeout` = `timeoutFactor` × `timeout` `timeout`
* - `maxRetryTimeout` `timeout` `timeout` 10000 ms 10
* - `maxRetryCount` `Infinity`
*
* 4
*/
declare interface RetryConfiguration {
/**
* 500 ms
*/
timeout: number;
/**
*
*
* 1.5 {@link timeout}
*/
timeoutFactor: number;
/**
*
*
* `Infinity`
*/
maxRetryCount: number;
/**
*
*
* {@link timeout} `timeout` 10000 ms 10
*/
maxRetryTimeout: number;
}
declare interface RTMConfiguration {
/** RTM团队透传字段给ap */
apRTM: boolean;
rtmFlag: number;
}
/**
* SDK [[VideoEncoderConfiguration]]
*
* [AgoraRTC.createScreenVideoTrack]{@link IAgoraRTC.createScreenVideoTrack}
*
* SDK
*
* | | × | fps |
* | -------- | --------------- | ----------- |
* | "480p" | 640 × 480 | 5 |
* | "480p_1" | 640 × 480 | 5 |
* | "480p_2" | 640 × 480 | 30 |
* | "480p_3" | 640 × 480 | 15 |
* | "720p" | 1280 × 720 | 5 |
* | "720p_1" | 1280 × 720 | 5 |
* | "720p_2" | 1280 × 720 | 30 |
* | "720p_3" | 1280 × 720 | 15 |
* | "720p_auto" <sup></sup> | 1280 × 720 | 30 |
* | "1080p" | 1920 × 1080 | 5 |
* | "1080p_1" | 1920 × 1080 | 5 |
* | "1080p_2" | 1920 × 1080 | 30 |
* | "1080p_3" | 1920 × 1080 | 15 |
*
* > <sup></sup> `"720p_auto"` Safari [](https://doc.shengwang.cn/doc/rtc/javascript/overview/release-notes)。
*
*/
export declare type ScreenEncoderConfigurationPreset = keyof typeof SUPPORT_SCREEN_ENCODER_CONFIG_LIST;
/**
*
* - `"screen"`:
* - `"application"`: app
* - `"window"`: app
* @public
*/
export declare type ScreenSourceType = "screen" | "window" | "application";
/**
* [AgoraRTC.createScreenVideoTrack]{@link IAgoraRTC.createScreenVideoTrack}
*/
export declare interface ScreenVideoTrackInitConfig {
/**
*
*
*
* - [[ScreenEncoderConfigurationPreset]] SDK
* - [[VideoEncoderConfiguration]]
* - 使 SDK `"1080p_2"` 1920 × 1080 30 fps 3000 Kbps
*/
encoderConfig?: VideoEncoderConfiguration | ScreenEncoderConfigurationPreset;
/**
* 使 Electron `sourceId`
*/
electronScreenSourceId?: string;
/**
* 使 Chrome ID
*/
extensionId?: string;
/**
* @deprecated
*
* v4.17.1 {@link displaySurface}
*
*
*/
screenSourceType?: ScreenSourceType;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.2.0*
*
*
*
* 稿 `"detail"` `"motion"`
*
* > Chrome
*
* @param mode
* - `"detail"`:
* - SDK 使
* - SDK
* - `"motion"`: 4.21.0 SDK
* - SDK
* - SDK
*/
optimizationMode?: "motion" | "detail";
/**
* @ignore
*
* @自从
* <br>&emsp;&emsp;&emsp;*4.18.0*
*
* SVC
*
* {@link SVCConfigurationPreset} SDK SVC {@link SVCConfiguration} SVC
*/
scalabiltyMode?: SVCConfiguration | SVCConfigurationPreset;
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.17.1*
*
* [displaySurface](https://developer.chrome.com/docs/web-platform/screen-sharing-controls/#displaySurface)。
*
* ![](https://wd.imgix.net/image/vvhSqZboQoZZN9wBvoXq72wzGAf1/AaQIUrKKCvoNuaBjvGOM.png?auto=format&w=1600)
*
* > Chrome 107 Edge 107
*
*/
displaySurface?: "browser" | "window" | "monitor";
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.17.1*
*
*
* - `"include"`
* - `"exclude"`
*
* [selfBrowserSurface](https://developer.chrome.com/docs/web-platform/screen-sharing-controls/#selfBrowserSurface)。
*
* >
* > - Chrome 107 `"exclude"` SDK `"include"` Chrome 107
* > - Chrome 107 Edge 107
*/
selfBrowserSurface?: "include" | "exclude";
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.17.1*
*
*
* - `"include"`
* - `"exclude"`
*
* [surfaceSwitching](https://developer.chrome.com/docs/web-platform/screen-sharing-controls/#surfaceSwitching)。
*
* > Chrome 107 Edge 107
*/
surfaceSwitching?: "include" | "exclude";
/**
* @自从
* <br>&emsp;&emsp;&emsp;*4.17.1*
*
*
* - `"include"`
* - `"exclude"`
*
* [systemAudio](https://developer.chrome.com/docs/web-platform/screen-sharing-controls/#systemAudio)。
*
* > Windows Chrome 105 Edge 105
*/
systemAudio?: "include" | "exclude";
}
/**
* @ignore
*/
export declare type SDK_AUDIO_CODEC = keyof typeof AudioCodec;
/**
* 使
* - `"vp8"`: 使 VP8
* - `"h264"`: 使 H.264
* - `"vp9"`: (Beta) 使 VP9
* - `"av1"`: 使 AV1
*
* > Safari 12.1 VP8
* @public
*/
export declare type SDK_CODEC = keyof typeof VideoCodec;
/**
*
*
* Agora Web SDK app 使使
*
* :
* - `"live"`: [setClientRole]{@link IAgoraRTCClient.setClientRole}
* - `"rtc"`:
* @public
*/
export declare type SDK_MODE = "live" | "rtc" | "p2p";
declare enum StreamType {
/** 0: 高分辨率、高码率的视频大流。 */
HIGH_STREAM = 0,
/** 1: 低分辨率、低码率的视频小流。 */
LOW_STREAM = 1
}
declare const SUPPORT_SCREEN_ENCODER_CONFIG_LIST: Record<string, VideoEncoderConfiguration>;
declare const SUPPORT_SVC_CONFIG_LIST: Record<string, SVCConfiguration>;
declare const SUPPORT_VIDEO_ENCODER_CONFIG_LIST: Record<string, VideoEncoderConfiguration>;
/**
* @ignore
* @自从
* <br>&emsp;&emsp;&emsp;*4.18.0*
*
* SVC
*
* `SVCConfiguration` SVC
* - [AgoraRTC.createCameraVideoTrack]{@link IAgoraRTC.createCameraVideoTrack}
* - [AgoraRTC.createCustomVideoTrack]{@link IAgoraRTC.createCustomVideoTrack}
* - [AgoraRTC.createScreenVideoTrack]{@link IAgoraRTC.createScreenVideoTrack}
*/
export declare interface SVCConfiguration {
/**
* SVC
*/
numSpatialLayers: 1 | 2 | 3;
/**
* SVC
*/
numTemporalLayers: 1 | 3;
}
/**
* @ignore
*
* @自从
* <br>&emsp;&emsp;&emsp;*4.18.0*
*
* SDK SVC
* - `"1SL1TL"`: 1 1
* - `"3SL3TL"`: 3 3
* - `"2SL3TL"`: 2 3
*
* SVC
* - [AgoraRTC.createCameraVideoTrack]{@link IAgoraRTC.createCameraVideoTrack}
* - [AgoraRTC.createCustomVideoTrack]{@link IAgoraRTC.createCustomVideoTrack}
* - [AgoraRTC.createScreenVideoTrack]{@link IAgoraRTC.createScreenVideoTrack}
*
*/
export declare type SVCConfigurationPreset = keyof typeof SUPPORT_SVC_CONFIG_LIST;
/**
* @ignore
* TURN [setTurnServer]{@link IAgoraRTCClient.setTurnServer} 使
* @public
*/
export declare interface TurnServerConfig {
/**
* TURN URL ASCII
*/
turnServerURL: string;
/**
* TURN 使ASCII
*/
password: string;
/**
* UDP
*/
udpport?: number;
/**
* TURN 使ASCII
*/
username: string;
/**
*
* - `true`: TURN
* - `false`: TURN
*/
forceturn?: boolean;
/**
* TCP
*/
tcpport?: number;
security?: boolean;
}
/**
* ID ID
*
* 使 ID {@link join}
* @public
*/
export declare type UID = number | string;
declare enum VideoCodec {
h264 = "h264",
h265 = "h265",
vp8 = "vp8",
vp9 = "vp9",
av1 = "av1"
}
/**
*
*
* [AgoraRTC.createCameraVideoTrack]{@link IAgoraRTC.createCameraVideoTrack} [AgoraRTC.createScreenVideoTrack]{@link IAgoraRTC.createScreenVideoTrack}
*
* SDK [[VideoEncoderConfigurationPreset]]
*
* > 100 Kbps 5000 Kbps
*
* @public
*/
export declare interface VideoEncoderConfiguration {
/**
*
*
* `number` `{ max: 1280, min: 720 }`
*
* [ConstrainLong]{@link ConstrainLong}
*/
width?: number | ConstrainLong;
/**
*
*
* `number` `{ max: 1280, min: 720 }`
*
* [ConstrainLong]{@link ConstrainLong}
*/
height?: number | ConstrainLong;
/**
* fps
*
* `number` `{ max: 30, min: 5 }`
*
* [ConstrainLong]{@link ConstrainLong}
*/
frameRate?: number | ConstrainLong;
/**
* Kbps
*/
bitrateMin?: number;
/**
* Kbps
*/
bitrateMax?: number;
/**
* @ignore
*/
scaleResolutionDownBy?: number;
}
/**
* SDK [[VideoEncoderConfiguration]]
*
* [AgoraRTC.createCameraVideoTrack]{@link IAgoraRTC.createCameraVideoTrack}
*
* SDK SDK 使 `"480p_1"`
*
* | | × | fps | Chrome | Firefox | Safari |
* | -------- | --------------- | ----------- | ------ | ------- | ------ |
* | 120p | 160 × 120 | 15 | | | |
* | 120p_1 | 160 × 120 | 15 | | | |
* | 120p_3 | 120 × 120 | 15 | | | |
* | 180p | 320 × 180 | 15 | | | |
* | 180p_1 | 320 × 180 | 15 | | | |
* | 180p_3 | 180 × 180 | 15 | | | |
* | 180p_4 | 240 × 180 | 15 | | | |
* | 240p | 320 × 240 | 15 | | | |
* | 240p_1 | 320 × 240 | 15 | | | |
* | 240p_3 | 240 × 240 | 15 | | | |
* | 240p_4 | 424 × 240 | 15 | | | |
* | 360p | 640 × 360 | 15 | | | |
* | 360p_1 | 640 × 360 | 15 | | | |
* | 360p_3 | 360 × 360 | 15 | | | |
* | 360p_4 | 640 × 360 | 30 | | | |
* | 360p_6 | 360 × 360 | 30 | | | |
* | 360p_7 | 480 × 360 | 15 | | | |
* | 360p_8 | 480 × 360 | 30 | | | |
* | 360p_9 | 640 × 360 | 15 | | | |
* | 360p_10 | 640 × 360 | 24 | | | |
* | 360p_11 | 640 × 360 | 24 | | | |
* | 480p | 640 × 480 | 15 | | | |
* | 480p_1 | 640 × 480 | 15 | | | |
* | 480p_2 | 640 × 480 | 30 | | | |
* | 480p_3 | 480 × 480 | 15 | | | |
* | 480p_4 | 640 × 480 | 30 | | | |
* | 480p_6 | 480 × 480 | 30 | | | |
* | 480p_8 | 848 × 480 | 15 | | | |
* | 480p_9 | 848 × 480 | 30 | | | |
* | 480p_10 | 640 × 480 | 10 | | | |
* | 720p | 1280 × 720 | 15 | | | |
* | 720p_1 | 1280 × 720 | 15 | | | |
* | 720p_2 | 1280 × 720 | 30 | | | |
* | 720p_3 | 1280 × 720 | 30 | | | |
* | 720p_auto <sup></sup> | 1280 × 720 | 30 | | | |
* | 720p_5 | 960 × 720 | 15 | | | |
* | 720p_6 | 960 × 720 | 30 | | | |
* | 1080p | 1920 × 1080 | 15 | | | |
* | 1080p_1 | 1920 × 1080 | 15 | | | |
* | 1080p_2 | 1920 × 1080 | 30 | | | |
* | 1080p_3 | 1920 × 1080 | 30 | | | |
* | 1080p_5 | 1920 × 1080 | 60 | | | |
*
* > <sup></sup> `"720p_auto"` Safari [](https://doc.shengwang.cn/doc/rtc/javascript/overview/release-notes)。
*
* @public
*/
export declare type VideoEncoderConfigurationPreset = keyof typeof SUPPORT_VIDEO_ENCODER_CONFIG_LIST;
/**
* [LocalVideoTrack.play]{@link ILocalVideoTrack.play}
*/
export declare interface VideoPlayerConfig {
/**
*
* - `true`:
* - `false`:
*
* >
* > -
* > -
*/
mirror?: boolean;
/**
*
* - `"cover"`: CSS `object-fit` `cover`
* - `"contain"`: CSS `object-fit` `contain`
* - `"fill"`: CSS `object-fit` `fill`
*
* >
* > - 使 cover 使 contain
* > - 使 cover
*/
fit?: "cover" | "contain" | "fill";
}
/**
*
* @public
*/
export declare enum VideoState {
/** 0: 视频默认初始状态。 */
VideoStateStopped = 0,
/** 1: 本地用户已接收视频首包。 */
VideoStateStarting = 1,
/** 2: 视频流正在解码,正常播放。 */
VideoStateDecoding = 2,
/** 3: 视频流卡顿。 */
VideoStateFrozen = 3
}
/**
* @ignore
*/
declare enum VisibleHiddenReason {
COVERED = "COVERED",
POSITION = "POSITION",
SIZE = "SIZE",
STYLE = "STYLE"
}
declare interface VisibleHiddenResult {
visible: false;
reason: keyof typeof VisibleHiddenReason;
}
/**
* @ignore
*/
declare interface VisibleResultInner {
visible: true;
}
export { }