AudioEncoderConfigurationPreset
AudioEncoderConfigurationPreset: keyof object
SDK 预设的 AudioEncoderConfiguration 配置。
你可以在以下方法中传入预设值来控制本地音频的编码配置:
下表列出了 SDK 所有内置的音频属性配置,SDK 默认使用 "music_standard"。
| 音频属性 | 配置 |
|---|---|
"speech_low_quality" | 16 kHz 采样率,单声道,编码码率约 24 Kbps |
"speech_standard" | 32 kHz 采样率,单声道,编码码率约 24 Kbps |
"music_standard" | 48 kHz 采样率,单声道,编码码率约 40 Kbps |
"standard_stereo" | 48 kHz 采样率,双声道,编码码率约 64 Kbps |
"high_quality" | 48 kHz 采样率,单声道, 编码码率约 128 Kbps |
"high_quality_stereo" | 48 kHz 采样率,双声道,编码码率约 192 Kbps |
AudioSourceState
AudioSourceState: "stopped" | "playing" | "paused"
音频源数据处理状态,通过 BufferSourceAudioTrack.on("source-state-change") 获取。
"stopped": 音频源数据处理停止。可能是因为数据处理完毕,也可能是手动触发了停止。"playing": 音频源数据正在处理。"paused": 音频源数据暂停处理。
ClientRole
ClientRole: "audience" | "host"
用户角色。
"host": 直播场景中的主播,可以发布和订阅音视频轨道。"audience": 直播场景中的观众,只能订阅,不能发布音视频轨道。
ConnectionState
ConnectionState: "DISCONNECTED" | "CONNECTING" | "RECONNECTING" | "CONNECTED" | "DISCONNECTING"
SDK 和 anyRTC 服务器的连接状态,可以通过 connectionState 获取。
SDK 和服务器有以下 5 种连接状态:
-
"DISCONNECTED": 连接断开。该状态表示用户处于以下任一阶段: -
"CONNECTING": 正在连接中。当调用 join 时为此状态。 -
"CONNECTED": 已连接。该状态表示用户已经加入频道,可以在频道内发布或订阅媒体流。 -
"RECONNECTING": 正在重连中。因网络断开或切换而导致 SDK 与服务器的连接中断,SDK 会自动重连,此时连接状态变为"RECONNECTING"。 -
"DISCONNECTING": 正在断开连接。在调用 leave 的时候为此状态。
DeviceState
DeviceState: "ACTIVE" | "INACTIVE"
采集设备当前的插拔状态。
"ACTIVE": 该设备已经插入。"INACTIVE": 该设备已经被拔出。
EncryptionMode
EncryptionMode: "aes-128-ecb" | "none"
暂时仅支持 aes-128-ecb。
加密方案,在调用 setEncryptionConfig 时使用。包含以下几种:
"aes-128-ecb": 128 位 AES 加密,ECB 模式。
"none": 不加密。
SDK_CODEC
SDK_CODEC: "h264" | "vp8"
浏览器使用的编码格式,有以下两种选择:
"vp8": 浏览器使用 VP8 编码。"h264": 浏览器使用 H.264 编码。
Safari 12.1 之前版本不支持 VP8 编码。
SDK_MODE
SDK_MODE: "live" | "rtc"
频道场景。
anyRTC Web SDK 需知道 app 的使用场景(例如通信模式或直播模式),从而使用不同的优化手段。
anyRTC 频道支持以下场景:
"live": 直播场景,有主播和观众两种用户角色,可以通过 setClientRole 方法设置主播和观众的角色。主播可以收发音视频流,而观众只能接收音视频流,无法发送。"rtc": 通信场景,用于常见的一对一通话或群聊,频道中的任何用户可以自由说话。
ScreenEncoderConfigurationPreset
ScreenEncoderConfigurationPreset: keyof object
SDK 预设的 VideoEncoderConfiguration 配置。
你可以在 ArRTC.createScreenVideoTrack 方法中传入以下预设值来控制屏幕共享视频编码配置。
下表列出了 SDK 所有预设的屏幕共享视频属性配置。
| 视频属性 | 分辨率(宽×高) | 帧率(fps) |
|---|---|---|
| 480p | 640 × 480 | 5 |
| 480p_1 | 640 × 480 | 5 |
| 480p_2 | 640 × 480 | 30 |
| 720p | 1280 × 720 | 5 |
| 720p_1 | 1280 × 720 | 5 |
| 720p_2 | 1280 × 720 | 30 |
| 1080p | 1920 × 1080 | 5 |
| 1080p_1 | 1920 × 1080 | 5 |
| 1080p_2 | 1920 × 1080 | 30 |
ScreenSourceType
ScreenSourceType: "screen" | "window" | "application"
屏幕共享源的类型。
"screen": 共享屏幕。"application": 共享某一个 app 的所有窗口。"window": 共享某一个 app 的某一个窗口。
UID
UID: number | string
用于标识用户的 ID。同一频道中每个用户都具有唯一的 ID,且数据类型相同。
VideoEncoderConfigurationPreset
VideoEncoderConfigurationPreset: keyof object
SDK 预设的 VideoEncoderConfiguration 配置。
你可以在 ArRTC.createCameraVideoTrack 方法中传入预设的视频编码配置。
下表列出了 SDK 所有内置的视频属性配置,SDK 默认使用 "480p_1"。
| 视频属性 | 分辨率(宽×高) | 帧率(fps) | 码率(Kbps) | Chrome | Firefox | Safari |
|---|---|---|---|---|---|---|
| 120p | 160 × 120 | 15 | 65 | ✓ | ||
| 120p_1 | 160 × 120 | 15 | 65 | ✓ | ||
| 120p_3 | 120 × 120 | 15 | 50 | ✓ | ||
| 180p | 320 × 180 | 15 | 140 | ✓ | ||
| 180p_1 | 320 × 180 | 15 | 140 | ✓ | ||
| 180p_3 | 180 × 180 | 15 | 100 | ✓ | ||
| 180p_4 | 240 × 180 | 15 | 120 | ✓ | ||
| 240p | 320 × 240 | 15 | 200 | ✓ | ||
| 240p_1 | 320 × 240 | 15 | 200 | ✓ | ||
| 240p_3 | 240 × 240 | 15 | 140 | ✓ | ||
| 240p_4 | 424 × 240 | 15 | 220 | ✓ | ||
| 360p | 640 × 360 | 15 | 400 | ✓ | ||
| 360p_1 | 640 × 360 | 15 | 400 | ✓ | ||
| 360p_3 | 360 × 360 | 15 | 260 | ✓ | ||
| 360p_4 | 640 × 360 | 30 | 600 | ✓ | ||
| 360p_6 | 360 × 360 | 30 | 400 | ✓ | ||
| 360p_7 | 480 × 360 | 15 | 320 | ✓ | ||
| 360p_8 | 480 × 360 | 30 | 490 | ✓ | ||
| 360p_9 | 640 × 360 | 15 | 800 | ✓ | ||
| 360p_10 | 640 × 360 | 24 | 800 | ✓ | ||
| 360p_11 | 640 × 360 | 24 | 1000 | ✓ | ||
| 480p | 640 × 480 | 15 | 500 | ✓ | ✓ | ✓ |
| 480p_1 | 640 × 480 | 15 | 500 | ✓ | ✓ | ✓ |
| 480p_2 | 640 × 480 | 30 | 1000 | ✓ | ✓ | ✓ |
| 480p_3 | 480 × 480 | 15 | 400 | ✓ | ✓ | ✓ |
| 480p_4 | 640 × 480 | 30 | 750 | ✓ | ✓ | ✓ |
| 480p_6 | 480 × 480 | 30 | 600 | ✓ | ✓ | ✓ |
| 480p_8 | 848 × 480 | 15 | 610 | ✓ | ✓ | ✓ |
| 480p_9 | 848 × 480 | 30 | 930 | ✓ | ✓ | ✓ |
| 480p_10 | 640 × 480 | 10 | 400 | ✓ | ✓ | ✓ |
| 720p | 1280 × 720 | 15 | 1130 | ✓ | ✓ | ✓ |
| 720p_1 | 1280 × 720 | 15 | 1130 | ✓ | ✓ | ✓ |
| 720p_2 | 1280 × 720 | 30 | 2000 | ✓ | ✓ | ✓ |
| 720p_3 | 1280 × 720 | 30 | 1710 | ✓ | ✓ | ✓ |
| 720p_5 | 960 × 720 | 15 | 910 | ✓ | ✓ | ✓ |
| 720p_6 | 960 × 720 | 30 | 1380 | ✓ | ✓ | ✓ |
| 1080p | 1920 × 1080 | 15 | 2080 | ✓ | ✓ | |
| 1080p_1 | 1920 × 1080 | 15 | 2080 | ✓ | ✓ | |
| 1080p_2 | 1920 × 1080 | 30 | 3000 | ✓ | ✓ | |
| 1080p_3 | 1920 × 1080 | 30 | 3150 | ✓ | ✓ | |
| 1080p_5 | 1920 × 1080 | 60 | 4780 | ✓ | ✓ | |
| 1440p | 2560 × 1440 | 30 | 4850 | ✓ | ✓ | |
| 1440p_1 | 2560 × 1440 | 30 | 4850 | ✓ | ✓ | |
| 1440p_2 | 2560 × 1440 | 60 | 7350 | ✓ | ✓ | |
| 4K | 3840 × 2160 | 30 | 8910 | ✓ | ✓ | |
| 4K_1 | 3840 × 2160 | 30 | 8910 | ✓ | ✓ | |
| 4K_3 | 3840 × 2160 | 60 | 13500 | ✓ | ✓ |
Variables
Const AUDIO_ENCODER_CONFIG_SETTINGS
AUDIO_ENCODER_CONFIG_SETTINGS: object
Type declaration
-
high_quality: AudioEncoderConfiguration
-
high_quality_stereo: AudioEncoderConfiguration
-
music_standard: AudioEncoderConfiguration
-
speech_low_quality: AudioEncoderConfiguration
-
speech_standard: AudioEncoderConfiguration
-
standard_stereo: AudioEncoderConfiguration
Const ArRTC
ArRTC: ArRTC
Const SUPPORT_SCREEN_ENCODER_CONFIG_LIST
SUPPORT_SCREEN_ENCODER_CONFIG_LIST: object
Type declaration
-
1080p: VideoEncoderConfiguration
-
1080p_1: VideoEncoderConfiguration
-
1080p_2: VideoEncoderConfiguration
-
480p: VideoEncoderConfiguration
-
480p_1: VideoEncoderConfiguration
-
480p_2: VideoEncoderConfiguration
-
720p: VideoEncoderConfiguration
-
720p_1: VideoEncoderConfiguration
-
720p_2: VideoEncoderConfiguration
Const SUPPORT_VIDEO_ENCODER_CONFIG_LIST
SUPPORT_VIDEO_ENCODER_CONFIG_LIST: object
Type declaration
-
1080p: VideoEncoderConfiguration
-
1080p_1: VideoEncoderConfiguration
-
1080p_2: VideoEncoderConfiguration
-
1080p_3: VideoEncoderConfiguration
-
1080p_5: VideoEncoderConfiguration
-
120p: VideoEncoderConfiguration
-
120p_1: VideoEncoderConfiguration
-
120p_3: VideoEncoderConfiguration
-
120p_4: VideoEncoderConfiguration
-
1440p: VideoEncoderConfiguration
-
1440p_1: VideoEncoderConfiguration
-
1440p_2: VideoEncoderConfiguration
-
180p: VideoEncoderConfiguration
-
180p_1: VideoEncoderConfiguration
-
180p_3: VideoEncoderConfiguration
-
180p_4: VideoEncoderConfiguration
-
240p: VideoEncoderConfiguration
-
240p_1: VideoEncoderConfiguration
-
240p_3: VideoEncoderConfiguration
-
240p_4: VideoEncoderConfiguration
-
360p: VideoEncoderConfiguration
-
360p_1: VideoEncoderConfiguration
-
360p_10: VideoEncoderConfiguration
-
360p_11: VideoEncoderConfiguration
-
360p_3: VideoEncoderConfiguration
-
360p_4: VideoEncoderConfiguration
-
360p_6: VideoEncoderConfiguration
-
360p_7: VideoEncoderConfiguration
-
360p_8: VideoEncoderConfiguration
-
360p_9: VideoEncoderConfiguration
-
480p: VideoEncoderConfiguration
-
480p_1: VideoEncoderConfiguration
-
480p_10: VideoEncoderConfiguration
-
480p_2: VideoEncoderConfiguration
-
480p_3: VideoEncoderConfiguration
-
480p_4: VideoEncoderConfiguration
-
480p_6: VideoEncoderConfiguration
-
480p_8: VideoEncoderConfiguration
-
480p_9: VideoEncoderConfiguration
-
4k: VideoEncoderConfiguration
-
4k_1: VideoEncoderConfiguration
-
4k_3: VideoEncoderConfiguration
-
720p: VideoEncoderConfiguration
-
720p_1: VideoEncoderConfiguration
-
720p_2: VideoEncoderConfiguration
-
720p_3: VideoEncoderConfiguration
-
720p_5: VideoEncoderConfiguration
-
720p_6: VideoEncoderConfiguration
-
90p: VideoEncoderConfiguration
-
90p_1: VideoEncoderConfiguration

