类型定义
本页列出 Electron API 所有的类型定义。
AREA_CODE
访问区域,即 SDK 连接的服务器所在的区域。
枚举值
- AREA_CODE_CN
- 中国大陆。
- AREA_CODE_NA
- 北美区域。
- AREA_CODE_EU
- 欧洲区域。
- AREA_CODE_AS
- 除中国以外的亚洲区域。
- AREA_CODE_JP
- 日本。
- AREA_CODE_IN
- 印度。
- AREA_CODE_GLOB
- (默认)全球。
AUDIENCE_LATENCY_LEVEL_TYPE
直播频道中观众的延时级别。该枚举仅在用户角色设为 CLIENT_ROLE_AUDIENCE 时才生效。
枚举值
- AUDIENCE_LATENCY_LEVEL_LOW_LATENCY
- 1: 低延时。
- AUDIENCE_LATENCY_LEVEL_ULTRA_LOW_LATENCY
- 2:(默认)超低延时。
AUDIO_CODEC_PROFILE_TYPE
推流输出音频的编解码规格,默认为 LC-AAC。
枚举值
- AUDIO_CODEC_PROFILE_LC_AAC
- 0: (默认)LC-AAC 规格,表示基本音频编码规格。
- AUDIO_CODEC_PROFILE_HE_AAC
- 1: HE-AAC 规格,表示高效音频编码规格。
AUDIO_EFFECT_PRESET
预设的音效选项。
为获取更好的人声效果,Agora 建议在使用以下预设音效前将 setAudioProfile 的 profile 参数设置为 AUDIO_PROFILE_MUSIC_HIGH_QUALITY 或 AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO:
- ROOM_ACOUSTICS_KTV
- ROOM_ACOUSTICS_VOCAL_CONCERT
- ROOM_ACOUSTICS_STUDIO
- ROOM_ACOUSTICS_PHONOGRAPH
- ROOM_ACOUSTICS_SPACIAL
- ROOM_ACOUSTICS_ETHEREAL
- VOICE_CHANGER_EFFECT_UNCLE
- VOICE_CHANGER_EFFECT_OLDMAN
- VOICE_CHANGER_EFFECT_BOY
- VOICE_CHANGER_EFFECT_SISTER
- VOICE_CHANGER_EFFECT_GIRL
- VOICE_CHANGER_EFFECT_PIGKING
- VOICE_CHANGER_EFFECT_HULK
- PITCH_CORRECTION
枚举值
- AUDIO_EFFECT_OFF
- 原声,即关闭人声音效。
- ROOM_ACOUSTICS_KTV
- KTV。
- ROOM_ACOUSTICS_VOCAL_CONCERT
- 演唱会。
- ROOM_ACOUSTICS_STUDIO
- 录音棚。
- ROOM_ACOUSTICS_PHONOGRAPH
- 留声机。
- ROOM_ACOUSTICS_VIRTUAL_STEREO
-
虚拟立体声,即 SDK 将单声道的音频渲染出双声道的音效。
注意: 使用该预设音效前,你需要将 setAudioProfile 的 profile 参数设置为 AUDIO_PROFILE_MUSIC_HIGH_QUALITY 或 AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO,否则该预设音效的设置无效。 - ROOM_ACOUSTICS_SPACIAL
- 空旷。
- ROOM_ACOUSTICS_ETHEREAL
- 空灵。
- ROOM_ACOUSTICS_3D_VOICE
-
3D 人声,即 SDK 将音频渲染出在用户周围环绕的效果。环绕周期默认为 10 秒。设置该音效后,你还可以调用 setAudioEffectParameters 修改环绕周期。
注意:- 使用该预设音效前,你需要将 setAudioProfile 的 profile 参数设置为 AUDIO_PROFILE_MUSIC_STANDARD_STEREO 或 AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO,否则该预设音效的设置无效。
- 启用 3D 人声后,用户需要使用支持双声道的音频播放设备才能听到预期效果。
- VOICE_CHANGER_EFFECT_UNCLE
-
大叔。
注意: 建议用于处理男声,否则无法达到预期效果。 - VOICE_CHANGER_EFFECT_OLDMAN
老年男性。
注意: 建议用于处理男声,否则无法达到预期效果。- VOICE_CHANGER_EFFECT_BOY
-
男孩。
注意: 建议用于处理男声,否则无法达到预期效果。 - VOICE_CHANGER_EFFECT_SISTER
-
少女。
注意: 建议用于处理女声,否则无法达到预期效果。 - VOICE_CHANGER_EFFECT_GIRL
-
女孩。
注意: 建议用于处理女声,否则无法达到预期效果。 - VOICE_CHANGER_EFFECT_PIGKING
- 猪八戒。
- VOICE_CHANGER_EFFECT_HULK
- 绿巨人。
- STYLE_TRANSFORMATION_RNB
-
R&B。
注意: 使用该预设音效前,你需要将 setAudioProfile 的 profile 参数设置为 AUDIO_PROFILE_MUSIC_HIGH_QUALITY 或 AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO,否则该预设音效的设置无效。 - STYLE_TRANSFORMATION_POPULAR
-
流行。
注意: 使用该预设音效前,你需要将 setAudioProfile 的 profile 参数设置为 AUDIO_PROFILE_MUSIC_HIGH_QUALITY 或 AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO,否则该预设音效的设置无效。 - PITCH_CORRECTION
- 电音,即 SDK 以主音音高为 C 的自然大调为基础修正音频的实际音高。设置该音效后,你还可以调用 setAudioEffectParameters 调整修音的基础调式和主音音高。
AUDIO_EQUALIZATION_BAND_FREQUENCY
语音音效均衡波段的中心频率。
枚举值
- AUDIO_EQUALIZATION_BAND_31
- 0: 31 Hz
- AUDIO_EQUALIZATION_BAND_62
- 1: 62 Hz
- AUDIO_EQUALIZATION_BAND_125
- 2: 125 Hz
- AUDIO_EQUALIZATION_BAND_250
- 3: 250 Hz
- AUDIO_EQUALIZATION_BAND_500
- 4: 500 Hz
- AUDIO_EQUALIZATION_BAND_1K
- 5: 1 kHz
- AUDIO_EQUALIZATION_BAND_2K
- 6: 2 kHz
- AUDIO_EQUALIZATION_BAND_4K
- 7: 4 kHz
- AUDIO_EQUALIZATION_BAND_8K
- 8: 8 kHz
- AUDIO_EQUALIZATION_BAND_16K
- 9: 16 kHz
AUDIO_MIXING_ERROR_TYPE
播放音乐文件时可能出现的错误。
- 弃用:
- 从 v3.4.0 起废弃。
枚举值
- AUDIO_MIXING_ERROR_CAN_NOT_OPEN
- 音乐文件打开出错。
- AUDIO_MIXING_ERROR_TOO_FREQUENT_CALL
- 音乐文件打开太频繁。
- AUDIO_MIXING_ERROR_INTERRUPTED_EOF
- 音乐文件播放中断。
- AUDIO_MIXING_ERROR_OK
- 音乐文件正常播放。
AUDIO_MIXING_REASON_TYPE
音乐文件播放状态改变的原因。在 AUDIO_MIXING_STATE_CHANGED 回调中报告。
枚举值
- AUDIO_MIXING_REASON_CAN_NOT_OPEN
- 701: 音乐文件打开出错。例如,本地音乐文件不存在、文件格式不支持或无法访问在线音乐文件 URL。
- AUDIO_MIXING_REASON_TOO_FREQUENT_CALL
- 702: 音乐文件打开太频繁。如需多次调用 startAudioMixing,请确保调用间隔大于 500 ms。
- AAUDIO_MIXING_REASON_INTERRUPTED_EOF
- 703: 音乐文件播放中断。
- AUDIO_MIXING_REASON_STARTED_BY_USER
- 720: 成功调用 startAudioMixing 播放音乐文件。
- AUDIO_MIXING_REASON_ONE_LOOP_COMPLETED
- 721: 音乐文件完成一次循环播放。
- AUDIO_MIXING_REASON_START_NEW_LOOP
- 722: 音乐文件开始新的一次循环播放。
- AUDIO_MIXING_REASON_ALL_LOOPS_COMPLETED
- 723: 音乐文件完成所有循环播放。
- AUDIO_MIXING_REASON_STOPPED_BY_USER
- 724: 成功调用 stopAudioMixing 停止播放音乐文件。
- AUDIO_MIXING_REASON_PAUSED_BY_USER
- 725: 成功调用 pauseAudioMixing 暂停播放音乐文件。
- AUDIO_MIXING_REASON_RESUMED_BY_USER
- 726: 成功调用 resumeAudioMixing 恢复播放音乐文件。
AUDIO_MIXING_STATE_TYPE
音乐文件播放状态。
枚举值
- AUDIO_MIXING_STATE_PLAYING
-
710: 音乐文件正常播放。
该状态可能由于以下原因导致:- AUDIO_MIXING_REASON_STARTED_BY_USER(710)
- AUDIO_MIXING_REASON_ONE_LOOP_COMPLETED(720)
- AUDIO_MIXING_REASON_START_NEW_LOOP(722)
- AUDIO_MIXING_REASON_RESUMED_BY_USER(726)
- AUDIO_MIXING_STATE_PAUSED
-
711: 音乐文件暂停播放。
该状态由 AUDIO_MIXING_REASON_PAUSED_BY_USER(725) 原因导致。
- AUDIO_MIXING_STATE_STOPPED
-
713: 音乐文件停止播放。
该状态可能由以下原因导致:- AUDIO_MIXING_REASON_ALL_LOOPS_COMPLETED(723)
- AUDIO_MIXING_REASON_STOPPED_BY_USER(724)
- AUDIO_MIXING_STATE_FAILED
-
714: 音乐文件播放出错。
该状态可能由以下原因导致:- AUDIO_MIXING_REASON_CAN_NOT_OPEN(701)
- AUDIO_MIXING_REASON_TOO_FREQUENT_CALL(702)
- AAUDIO_MIXING_REASON_INTERRUPTED_EOF(703)
AUDIO_PROFILE_TYPE
音频属性,包括采样率、码率、编码模式和声道数。
枚举值
- AUDIO_PROFILE_DEFAULT
-
0: 默认的音频属性。
- 直播场景下:48 kHz 采样率,音乐编码,单声道,编码码率最大值为 64 Kbps。
- 通信场景下:
- Windows 平台:16 kHz 采样率,语音编码,单声道,编码码率最大值为 16 Kbps。
- macOS 平台:32 kHz 采样率,语音编码,单声道,编码码率最大值为 18 Kbps。
- AUDIO_PROFILE_SPEECH_STANDARD
- 1: 指定 32 kHz 采样率,语音编码,单声道,编码码率最大值为 18 Kbps。
- AUDIO_PROFILE_MUSIC_STANDARD
- 2: 指定 48 kHz 采样率,音乐编码,单声道,编码码率最大值为 64 Kbps。
- AUDIO_PROFILE_MUSIC_STANDARD_STEREO
- 3: 指定 48 kHz 采样率,音乐编码,双声道,编码码率最大值为 80 Kbps。
- AUDIO_PROFILE_MUSIC_HIGH_QUALITY
- 4: 指定 48 kHz 采样率,音乐编码,单声道,编码码率最大值为 96 Kbps。
- AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO
- 5: 指定 48 kHz 采样率,音乐编码,双声道,编码码率最大值为 128 Kbps。
- AUDIO_PROFILE_NUM
- 枚举值边界。
AUDIO_RECORDING_POSITION
录音内容。在 startAudioRecordingWithConfig 中设置。
枚举值
- AUDIO_RECORDING_POSITION_MIXED_RECORDING_AND_PLAYBACK
- 0:(默认)录制本地和所有远端用户混音后的音频。
- AUDIO_RECORDING_POSITION_RECORDING
- 1: 仅录制本地用户的音频。
- AUDIO_RECORDING_POSITION_MIXED_PLAYBACK
- 2: 仅录制所有远端用户的音频。
AUDIO_RECORDING_QUALITY_TYPE
录音音质。
枚举值
- AUDIO_RECORDING_QUALITY_LOW
- 0: 低音质。采样率为 32 kHz,录制 10 分钟的文件大小为 1.2 M 左右。
- AUDIO_RECORDING_QUALITY_MEDIUM
- 1: 中音质。采样率为 32 kHz,录制 10 分钟的文件大小为 2 M 左右。
- AUDIO_RECORDING_QUALITY_HIGH
- 2: 高音质。采样率为 32 kHz,录制 10 分钟的文件大小为 3.75 M 左右。
AUDIO_REVERB_PRESET
预设的语音混响效果。
- 弃用:
- 自 v3.2.0 废弃。
枚举值
- AUDIO_REVERB_OFF
- 原声,即关闭本地语音混响。
- AUDIO_REVERB_FX_KTV
- KTV(增强版)。
- AUDIO_REVERB_FX_VOCAL_CONCERT
- 演唱会(增强版)。
- AUDIO_REVERB_FX_UNCLE
- 大叔。
- AUDIO_REVERB_FX_SISTER
- 小姐姐。
- AUDIO_REVERB_FX_STUDIO
- 录音棚(增强版)。
- AUDIO_REVERB_FX_POPULAR
- 流行(增强版)。
- AUDIO_REVERB_FX_RNB
- R&B(增强版)。
- AUDIO_REVERB_FX_PHONOGRAPH
- 留声机。
- AUDIO_REVERB_POPULAR
- 流行。
- AUDIO_REVERB_RNB
- R&B。
- AUDIO_REVERB_ROCK
- 摇滚。
- AUDIO_REVERB_HIPHOP
- 嘻哈。
- AUDIO_REVERB_VOCAL_CONCERT
- 演唱会。
- AUDIO_REVERB_KTV
- KTV。
- AUDIO_REVERB_STUDIO
- 录音棚。
- AUDIO_VIRTUAL_STEREO
- 虚拟立体声。虚拟立体声是指将单声道的音轨渲染出立体声的效果。
AUDIO_REVERB_TYPE
音频混响类型。
枚举值
- AUDIO_REVERB_DRY_LEVEL
- 0: 原始声音强度,即所谓的 dry signal,取值范围 [-20,10],单位为 dB。
- AUDIO_REVERB_WET_LEVEL
- 1: 早期反射信号强度,即所谓的 wet signal,取值范围 [-20,10],单位为 dB。
- AUDIO_REVERB_ROOM_SIZE
- 2: 所需混响效果的房间尺寸,一般房间越大,混响越强,取值范围 [0,100],单位为 dB。
- AUDIO_REVERB_WET_DELAY
- 3: Wet signal 的初始延迟长度,取值范围 [0,200],单位为毫秒。
- AUDIO_REVERB_STRENGTH
- 4: 混响持续的强度,取值范围为 [0,100]。
AUDIO_ROUTE_TYPE
语音路由的类型。
枚举值
- AUDIO_ROUTE_DEFAULT
- 默认的语音路由。
- AUDIO_ROUTE_HEADSET
- 耳机。
- AUDIO_ROUTE_EARPIECE
- 听筒。
- AUDIO_ROUTE_HEADSET_NO_MIC
- 不带麦的耳机。
- AUDIO_ROUTE_SPEAKERPHONE
- 手机的扬声器。
- AUDIO_ROUTE_LOUDSPEAKER
- 外接的扬声器。
- AUDIO_ROUTE_BLUETOOTH
- 蓝牙耳机。
- AUDIO_ROUTE_USB
- USB 外围设备(仅适用于 macOS)。
- AUDIO_ROUTE_HDMI
- HDMI 外围设备(仅适用于 macOS)。
- AUDIO_ROUTE_DISPLAYPORT
- DisplayPort 外围设备(仅适用于 macOS)。
- AUDIO_ROUTE_AIRPLAY
- Apple AirPlay(仅适用于 macOS)。
AUDIO_SAMPLE_RATE_TYPE
推流输出音频的采样率。
枚举值
- AUDIO_SAMPLE_RATE_32000
- 32000: 32 kHz
- AUDIO_SAMPLE_RATE_44100
- 44100: 44.1 kHz
- AUDIO_SAMPLE_RATE_48000
- 48000: (默认)48 kHz
AUDIO_SCENARIO_TYPE
设置音频应用场景。
枚举值
- AUDIO_SCENARIO_DEFAULT
- 0: 默认的音频应用场景。
- AUDIO_SCENARIO_CHATROOM_ENTERTAINMENT
- 1: 娱乐场景,适用于用户需要频繁上下麦的场景。
- AUDIO_SCENARIO_EDUCATION
- 2: 教育场景,适用于需要高流畅度和稳定性的场景。
- AUDIO_SCENARIO_GAME_STREAMING
- 3: 高音质语聊房场景,适用于音乐为主的场景。
- AUDIO_SCENARIO_SHOWROOM
- 4: 秀场场景,适用于需要高音质的单主播场景。
- AUDIO_SCENARIO_CHATROOM_GAMING
- 5: 游戏开黑场景,适用于只有人声的场景。
- AUDIO_SCENARIO_IOT
- 6: IoT(物联网)场景,适用于使用低功耗 IoT 设备的场景。
- AUDIO_SCENARIO_MEETING
-
- 自从
- v3.2.0
8: 会议场景,适用于人声为主的多人会议。
- AUDIO_SCENARIO_NUM
- 枚举的数量。
CAPTURE_BRIGHTNESS_LEVEL_TYPE
本地采集的画质亮度级别。
- 自从
- v3.3.0
枚举值
- CAPTURE_BRIGHTNESS_LEVEL_INVALID
- -1: SDK 未检测出本地采集的画质亮度级别。请等待几秒,通过下一次回调的 captureBrightnessLevel 获取亮度级别。
- CAPTURE_BRIGHTNESS_LEVEL_NORMAL
- 0: 本地采集的画质亮度正常。
- CAPTURE_BRIGHTNESS_LEVEL_BRIGHT
- 1: 本地采集的画质亮度偏亮。
- CAPTURE_BRIGHTNESS_LEVEL_DARK
- 2: 本地采集的画质亮度偏暗。
CAPTURER_OUTPUT_PREFERENCE
摄像头采集偏好。
枚举值
- CAPTURER_OUTPUT_PREFERENCE_AUTO
- 0:(默认)自动调整采集参数。SDK 根据实际的采集设备性能及网络情况,选择合适的摄像头输出参数,在设备性能及视频预览质量之间,维持平衡。
- CAPTURER_OUTPUT_PREFERENCE_PERFORMANCE
- 1: 优先保证设备性能。SDK 根据用户在 setVideoEncoderConfiguration 中设置编码器的分辨率和帧率,选择最接近的摄像头输出参数,从而保证设备性能。在这种情况下,预览质量接近于编码器的输出质量。
- CAPTURER_OUTPUT_PREFERENCE_PREVIEW
- 2: 优先保证视频预览质量。SDK 选择较高的摄像头输出参数,从而提高预览视频的质量。在这种情况下,会消耗更多的 CPU 及内存做视频前处理。
- CAPTURER_OUTPUT_PREFERENCE_MANUAL
-
- 自从
- v3.3.0
3: 允许用户设置本地摄像头采集的视频宽高。
CHANNEL_MEDIA_RELAY_ERROR
跨频道媒体流转发出错的错误码。
枚举值
- RELAY_OK
- 0: 一切正常。
- RELAY_ERROR_SERVER_ERROR_RESPONSE
- 1: 服务器回应出错。
- RELAY_ERROR_SERVER_NO_RESPONSE
-
2: 服务器无回应。
你可以调用 leaveChannel 方法离开频道。
该错误也可能是由于当前的 App ID 未开启连麦鉴权导致的。你可以提交工单申请开通连麦鉴权服务。
- RELAY_ERROR_NO_RESOURCE_AVAILABLE
- 3: SDK 无法获取服务,可能是因为服务器资源有限导致。
- RELAY_ERROR_FAILED_JOIN_SRC
- 4: 发起跨频道转发媒体流请求失败。
- RELAY_ERROR_FAILED_JOIN_DEST
- 5: 接受跨频道转发媒体流请求失败。
- RELAY_ERROR_FAILED_PACKET_RECEIVED_FROM_SRC
- 6: 服务器接收跨频道转发媒体流失败。
- RELAY_ERROR_FAILED_PACKET_SENT_TO_DEST
- 7: 服务器发送跨频道转发媒体流失败。
- RELAY_ERROR_SERVER_CONNECTION_LOST
- 8: SDK 因网络质量不佳与服务器断开。你可以调用 leaveChannel 方法离开当前频道。
- RELAY_ERROR_INTERNAL_ERROR
- 9: 服务器内部出错。
- RELAY_ERROR_SRC_TOKEN_EXPIRED
- 10: 源频道的 Token 已过期。
- RELAY_ERROR_DEST_TOKEN_EXPIRED
- 11: 目标频道的 Token 已过期。
CHANNEL_MEDIA_RELAY_EVENT
跨频道媒体流转发事件码。
枚举值
- RELAY_EVENT_NETWORK_DISCONNECTED
- 0: 网络中断导致用户与服务器连接断开。
- RELAY_EVENT_NETWORK_CONNECTED
- 1: 用户与服务器建立连接。
- RELAY_EVENT_PACKET_JOINED_SRC_CHANNEL
- 2: 用户已加入源频道。
- RELAY_EVENT_PACKET_JOINED_DEST_CHANNEL
- 3: 用户已加入目标频道。
- RELAY_EVENT_PACKET_SENT_TO_DEST_CHANNEL
- 4: SDK 开始向目标频道发送数据包。
- RELAY_EVENT_PACKET_RECEIVED_VIDEO_FROM_SRC
- 5: 服务器收到了频道发送的视频流。
- RELAY_EVENT_PACKET_RECEIVED_AUDIO_FROM_SRC
- 6: 服务器收到了频道发送的音频流。
- RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL
- 7: 目标频道已更新。
- RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL_REFUSED
- 8: 内部原因导致目标频道更新失败。
- RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL_NOT_CHANGE
- 9: 目标频道未发生改变,即目标频道更新失败。
- RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL_IS_NULL
- 10: 目标频道名为 null。
CHANNEL_MEDIA_RELAY_STATE
跨频道媒体流转发状态码。
枚举值
- RELAY_STATE_IDLE
- 0: 初始状态。在成功调用 stopChannelMediaRelay 停止跨频道媒体流转发后, CHANNEL_MEDIA_RELAY_STATE 会回调该状态。
- RELAY_STATE_CONNECTING
- 1: SDK 尝试跨频道。
- RELAY_STATE_RUNNING
- 2: 源频道主播成功加入目标频道。
- RELAY_STATE_FAILURE
- 3: 发生异常,详见 CHANNEL_MEDIA_RELAY_STATE 的 code 参数提示的错误信息。
CHANNEL_PROFILE_TYPE
频道使用场景。
枚举值
- CHANNEL_PROFILE_COMMUNICATION
- 0: (默认)通信场景。该场景下,频道内所有用户都可以发布和接收音、视频流。适用于语音通话、视频群聊等应用场景。
- CHANNEL_PROFILE_LIVE_BROADCASTING
- 1: 直播场景。该场景有主播和观众两种用户角色,可以通过 setClientRole 设置。主播可以发布和接收音视频流,观众直接接收流。适用于语聊房、视频直播、互动大班课等应用场景。
- CHANNEL_PROFILE_GAME
- 2: 游戏语音场景。Agora 不推荐使用该场景。
CLIENT_ROLE_TYPE
直播场景里的用户角色。
枚举值
- CLIENT_ROLE_BROADCASTER
- 1: 主播。主播可以发流也可以收流。
- CLIENT_ROLE_AUDIENCE
- 2:(默认)观众。观众只能收流不能发流。
CLOUD_PROXY_TYPE
云代理类型。
- 自从
- v3.3.0
枚举值
- NONE_PROXY
- 0: 不使用云代理。
- UDP_PROXY
- 1: UDP 协议的云代理。
CONNECTION_CHANGED_REASON_TYPE
网络连接状态发生变化的原因。
枚举值
- CONNECTION_CHANGED_CONNECTING
- 0: 建立网络连接中。
- CONNECTION_CHANGED_JOIN_SUCCESS
- 1: 成功加入频道。
- CONNECTION_CHANGED_INTERRUPTED
- 2: 网络连接中断。
- CONNECTION_CHANGED_BANNED_BY_SERVER
- 3: 网络连接被服务器禁止。服务端踢人场景时会报这个错。
- CONNECTION_CHANGED_JOIN_FAILED
- 4: 加入频道失败。SDK 在尝试加入频道 20 分钟后还是没能加入频道,会返回该状态,并停止尝试重连。
- CONNECTION_CHANGED_LEAVE_CHANNEL
- 5: 离开频道。
- CONNECTION_CHANGED_INVALID_APP_ID
- 6: 不是有效的 APP ID。请更换有效的 APP ID 重新加入频道。
- CONNECTION_CHANGED_INVALID_CHANNEL_NAME
- 7: 不是有效的频道名。请更换有效的频道名重新加入频道。
- CONNECTION_CHANGED_INVALID_TOKEN
- 8: 生成的 Token 无效。一般有以下原因:
- 在控制台上启用了 App Certificate,但加入频道未使用 Token。当启用了 App Certificate,必须使用 Token。
- 在调用 joinChannel 加入频道时指定的用户 ID 与生成 Token 时传入的用户 ID 不一致。
- CONNECTION_CHANGED_TOKEN_EXPIRED
- 9: 当前使用的 Token 过期,不再有效,需要重新在你的服务端申请生成 Token。
- CONNECTION_CHANGED_REJECTED_BY_SERVER
- 10: 此用户被服务器禁止。一般有以下原因:
- 用户已进入频道,再次调用加入频道的 API,例如 joinChannel,会返回此状态。停止调用该方法即可。
- 用户在调用 startEchoTest 进行通话测试时尝试加入频道。等待通话测试结束后再加入频道即可。
- CONNECTION_CHANGED_SETTING_PROXY_SERVER
- 11: 由于设置了代理服务器,SDK 尝试重连。
- CONNECTION_CHANGED_RENEW_TOKEN
- 12: 更新 Token 引起网络连接状态改变。
- CONNECTION_CHANGED_CLIENT_IP_ADDRESS_CHANGED
- 13: 客户端 IP 地址变更,可能是由于网络类型,或网络运营商的 IP 或端口发生改变引起。
- CONNECTION_CHANGED_KEEP_ALIVE_TIMEOUT
- 14: SDK 和服务器连接保活超时,进入自动重连状态 CONNECTION_STATE_RECONNECTING。
CONNECTION_STATE_TYPE
网络连接状态。
枚举值
- CONNECTION_STATE_DISCONNECTED
- 1: 网络连接断开。该状态表示 SDK 处于:
- 调用 joinChannel 加入频道前的初始化阶段。
- 或调用 leaveChannel 后的离开频道阶段。
- CONNECTION_STATE_CONNECTING
- 2: 建立网络连接中。该状态表示 SDK 在调用 joinChannel 后正在与指定的频道建立连接。
- 如果成功加入频道,app 会收到 CONNECTION_STATE_CHANGED 回调,通知当前网络状态变成 CONNECTION_STATE_CONNECTED。
- 建立连接后,SDK 还会初始化媒体,一切就绪后会回调 JOINED_CHANNEL。
- CONNECTION_STATE_CONNECTED
- 3: 网络已连接。该状态表示用户已经加入频道,可以在频道内发布或订阅媒体流。如果因网络断开或切换而导致 SDK 与频道的连接中断,SDK 会自动重连,此时 app 会收到 CONNECTION_STATE_CHANGED 回调,通知当前网络状态变成 CONNECTION_STATE_RECONNECTING。
- CONNECTION_STATE_RECONNECTING
- 4: 重新建立网络连接中。该状态表示 SDK 之前曾加入过频道,但因网络等原因连接中断了,此时 SDK 会自动尝试重新接入频道。
- 如果 SDK 无法在 10 秒内重新加入频道,则 CONNECTION_LOST 会被触发,SDK 会一直保持在 CONNECTION_STATE_RECONNECTING 的状态,并不断尝试重新加入频道。
- 如果 SDK 在断开连接后,20 分钟内还是没能重新加入频道,则应用程序会收到 CONNECTION_STATE_CHANGED 回调,通知 app 的网络状态进入 CONNECTION_STATE_FAILED,SDK 停止尝试重连。
- CONNECTION_STATE_FAILED
- 5: 网络连接失败。该状态表示 SDK 已不再尝试重新加入频道,需要调用 leaveChannel 离开频道。
- 如果用户还想重新加入频道,则需要再次调用 joinChannel。
- 如果 SDK 因服务器端使用 RESTful API 禁止加入频道,则 app 会收到 CONNECTION_STATE_CHANGED。
CONTENT_MODE
视频内容显示模式类型。
枚举值
- CROPPED
- 视频尺寸等比缩放。优先保证视窗被填满。因视频尺寸与视窗尺寸不一致而多出的视频将被截掉。
- FIT
- 视频尺寸等比缩放。优先保证视频内容全部显示。因视频尺寸与视窗尺寸不一致造成的视窗未被填满的区域填充黑色。
DEGRADATION_PREFERENCE
带宽受限时的视频编码降级偏好。
枚举值
- MAINTAIN_QUALITY
0:(默认)带宽受限时,视频编码时优先降低视频帧率,维持视频质量不变。该降级偏好适用于画质优先的场景。
注意: 通信(COMMUNICATION)场景下,本地发送的视频分辨率可能改变,远端用户需能处理这种情况, 详见 VIDEO_SIZE_CHANGED。- MAINTAIN_FRAMERATE
- 1:带宽受限时,视频编码时优先降低视频质量,维持视频帧率不变。该降级偏好适用于流畅性优先且允许画质降低的场景。
- MAINTAIN_BALANCED
-
2:带宽受限时,视频编码时同时降低视频帧率和视频质量。MAINTAIN_BALANCED 的降幅比 MAINTAIN_QUALITY 和 MAINTAIN_FRAMERATE 降幅更低, 适用于流畅性和画质均有限的场景。
注意: 本地发送的视频分辨率可能改变,远端用户需能处理这种情况,详见 VIDEO_SIZE_CHANGED。
ENCRYPTION_MODE
内置加密模式。
枚举值
- AES_128_XTS
- 1:(默认)128 位 AES 加密,XTS 模式。
- AES_128_ECB
- 2: 128 位 AES 加密,ECB 模式。
- AES_256_XTS
- 3: 256 位 AES 加密,XTS 模式。
- SM4_128_ECB
- 4: 128 位 SM4 加密,ECB 模式。
- AES_128_GCM
-
- 自从
- v3.3.1
5: 128 位 AES 加密,GCM 模式。
- AES_256_GCM
-
- 自从
- v3.3.1
6: 256 位 AES 加密,GCM 模式。
EXPERIENCE_POOR_REASON
接收远端音频时,本地用户主观体验质量较差的原因。
- 自从
- v3.3.0
枚举值
- EXPERIENCE_REASON_NONE
- 0: 无原因,说明主观体验质量较好。
- REMOTE_NETWORK_QUALITY_POOR
- 1: 远端用户的网络较差。
- LOCAL_NETWORK_QUALITY_POOR
- 2: 本地用户的网络较差。
- WIRELESS_SIGNAL_POOR
- 4: 本地用户的 Wi-FI 或者移动数据网络信号弱。
- WIFI_BLUETOOTH_COEXIST
- 8: 本地用户同时开启 Wi-Fi 和蓝牙,二者信号互相干扰,导致音频传输质量下降。
EXPERIENCE_QUALITY_TYPE
接收远端音频时,本地用户的主观体验质量。
- 自从
- v3.3.0
枚举值
- EXPERIENCE_QUALITY_GOOD
- 0: 主观体验质量较好。
- EXPERIENCE_QUALITY_BAD
- 1: 主观体验质量较差。
FRAME_RATE
视频帧率。
枚举值
- FRAME_RATE_FPS_1
- 1: 1 fps
- FRAME_RATE_FPS_7
- 7: 7 fps
- FRAME_RATE_FPS_10
- 10: 10 fps
- FRAME_RATE_FPS_15
- 15: 15 fps
- FRAME_RATE_FPS_24
- 24: 24 fps
- FRAME_RATE_FPS_30
- 30: 30 fps
INJECT_STREAM_STATUS
导入的外部视频源状态。
枚举值
- INJECT_STREAM_STATUS_START_SUCCESS
- 0: 外部视频流导入成功。
- INJECT_STREAM_STATUS_START_ALREADY_EXISTS
- 1: 外部视频流已存在。
- INJECT_STREAM_STATUS_START_UNAUTHORIZED
- 2: 外部视频流导入未经授权。
- INJECT_STREAM_STATUS_START_TIMEDOUT
- 3: 导入外部视频流超时。
- INJECT_STREAM_STATUS_START_FAILED
- 4: 外部视频流导入失败。
- INJECT_STREAM_STATUS_STOP_SUCCESS
- 5: 外部视频流停止导入成功。
- INJECT_STREAM_STATUS_STOP_NOT_FOUND
- 6: 未找到要停止导入的外部视频流。
- INJECT_STREAM_STATUS_STOP_UNAUTHORIZED
- 7: 要停止导入的外部视频流未经授权。
- INJECT_STREAM_STATUS_STOP_TIMEDOUT
- 8: 停止导入外部视频流超时。
- INJECT_STREAM_STATUS_STOP_FAILED
- 9: 停止导入外部视频流失败。
- INJECT_STREAM_STATUS_BROKEN
- 10: 导入的外部视频流被中断。
LASTMILE_PROBE_RESULT_STATE
Last mile 质量探测结果的状态。
枚举值
- LASTMILE_PROBE_RESULT_COMPLETE
- 1: 表示本次 last mile 质量探测的结果是完整的。
- LASTMILE_PROBE_RESULT_INCOMPLETE_NO_BWE
- 2: 表示本次 last mile 质量探测未进行带宽预测,因此结果不完整。一个可能的原因是测试资源暂时受限。
- LASTMILE_PROBE_RESULT_UNAVAILABLE
- 3: 未进行 last mile 质量探测。一个可能的原因是网络连接中断。
LIGHTENING_CONTRAST_LEVEL
亮度明暗对比度。
枚举值
- LIGHTENING_CONTRAST_LOW
- 低对比度。
- LIGHTENING_CONTRAST_NORMAL
- 正常对比度。
- LIGHTENING_CONTRAST_HIGH
- 高对比度。
LOCAL_AUDIO_STREAM_ERROR
本地音频出错原因。
枚举值
- LOCAL_AUDIO_STREAM_ERROR_OK
- 0: 本地音频状态正常。
- LOCAL_AUDIO_STREAM_ERROR_FAILURE
- 1: 本地音频出错原因不明确。
- LOCAL_AUDIO_STREAM_ERROR_DEVICE_NO_PERMISSION
- 2: 没有权限启动本地音频采集设备。
- LOCAL_AUDIO_STREAM_ERROR_DEVICE_BUSY
- 3: 本地音频采集设备已经在使用中。
- LOCAL_AUDIO_STREAM_ERROR_RECORD_FAILURE
- 4: 本地音频采集失败,建议你检查采集设备是否正常工作。
- LOCAL_AUDIO_STREAM_ERROR_ENCODE_FAILURE
- 5: 本地音频编码失败。
LOCAL_AUDIO_STREAM_STATE
本地音频状态。
枚举值
- LOCAL_AUDIO_STREAM_STATE_STOPPED
- 0: 本地音频默认初始状态。
- LOCAL_AUDIO_STREAM_STATE_RECORDING
- 1: 本地音频采集设备启动成功。
- LOCAL_AUDIO_STREAM_STATE_ENCODING
- 2: 本地音频首帧编码成功。
- LOCAL_AUDIO_STREAM_STATE_FAILED
- 3: 本地音频启动失败。
LOCAL_VIDEO_STREAM_ERROR
本地视频出错原因。
枚举值
- LOCAL_VIDEO_STREAM_ERROR_OK
- 0: 本地视频状态正常。
- LOCAL_VIDEO_STREAM_ERROR_FAILURE
- 1: 出错原因不明确。
- LOCAL_VIDEO_STREAM_ERROR_DEVICE_NO_PERMISSION
- 2: 没有权限启动本地视频采集设备。
- LOCAL_VIDEO_STREAM_ERROR_DEVICE_BUSY
- 3: 本地视频采集设备正在使用中。
- LOCAL_VIDEO_STREAM_ERROR_CAPTURE_FAILURE
- 4: 本地视频采集失败,建议检查采集设备是否正常工作。
- LOCAL_VIDEO_STREAM_ERROR_CAPTURE_FAILURE
- 5: 本地视频编码失败。
- LOCAL_VIDEO_STREAM_ERROR_DEVICE_NOT_FOUND
-
8: 找不到本地视频采集设备。
- LOCAL_VIDEO_STREAM_ERROR_SCREEN_CAPTURE_WINDOW_MINIMIZED
- 11: 调用 startScreenCaptureByWindow 方法共享窗口时,共享窗口处于最小化的状态。
- LOCAL_VIDEO_STREAM_ERROR_SCREEN_CAPTURE_WINDOW_CLOSED
-
- 自从
- v3.2.0
12: 该错误码表示通过窗口 ID 共享的窗口已关闭,或通过窗口 ID 共享的全屏窗口已退出全屏。 退出全屏模式后,远端用户将无法看到共享的窗口。为避免远端用户看到黑屏,Agora 建议你立即结束本次共享。
报告该错误码的常见场景:- 本地用户关闭共享的窗口时,SDK 会报告该错误码。
- 本地用户先放映幻灯片,然后共享放映中的幻灯片。结束放映时,SDK 会报告该错误码。
- 本地用户先全屏观看网页视频或网页文档,然后共享网页视频或网页文档。结束全屏时,SDK 会报告该错误码。
LOCAL_VIDEO_STREAM_STATE
本地视频状态。
枚举值
- LOCAL_VIDEO_STREAM_STATE_STOPPED
- 0: 本地视频默认初始状态。
- LOCAL_VIDEO_STREAM_STATE_CAPTURING
- 1: 本地视频采集设备启动成功。调用 startScreenCaptureByWindow 方法共享窗口且共享窗口为最大化时,也会报告该状态。
- LOCAL_VIDEO_STREAM_STATE_ENCODING
- 2: 本地视频首帧编码成功。
- LOCAL_VIDEO_STREAM_STATE_FAILED
- 3: 本地视频启动失败。
LOG_FILTER_TYPE
日志过滤等级。
枚举值
- LOG_FILTER_OFF
- 0: 不输出日志信息。
- LOG_FILTER_DEBUG
- 0x080f: 输出所有 API 日志信息。 如果你想获取最完整的日志,可以将日志级别设为该等级。
- LOG_FILTER_INFO
- 0x000f: 输出 CRITICAL、ERROR、WARNING 和 INFO 级别的日志信息。 我们推荐你将日志级别设为该等级。
- LOG_FILTER_WARN
- 0x000e: 输出 CRITICAL、ERROR 和 WARNING 级别的日志信息。
- LOG_FILTER_ERROR
- 0x000c: 输出 CRITICAL 和 ERROR 级别的日志信息。
- LOG_FILTER_CRITICAL
- 0x0008: 输出 CRITICAL 级别的日志信息。
LOG_LEVEL
日志输出等级。
- 自从
- v3.3.0
枚举值
- LOG_LEVEL_NONE
- 0: 不输出任何日志。
- LOG_LEVEL_INFO
- 0x0001:(默认)输出
FATAL
、ERROR
、WARN
、INFO
级别的日志。我们推荐你将日志级别设为该等级。 - LOG_LEVEL_WARN
- 0x0002: 仅输出
FATAL
、ERROR
、WARN
级别的日志。 - LOG_LEVEL_ERROR
- 0x0004: 仅输出
FATAL
、ERROR
级别的日志。 - LOG_LEVEL_FATAL
- 0x0008: 仅输出
FATAL
级别的日志。
MEDIA_DEVICE_STATE_TYPE
设备状态。
枚举值
- MEDIA_DEVICE_STATE_ACTIVE
- 1: 设备正在使用。
- MEDIA_DEVICE_STATE_DISABLED
- 2: 设备被禁用。
- MEDIA_DEVICE_STATE_NOT_PRESENT
- 4: 没有此设备。
- MEDIA_DEVICE_STATE_UNPLUGGED
- 8: 设备被拔出。
MEDIA_DEVICE_TYPE
设备类型。
枚举值
- UNKNOWN_AUDIO_DEVICE
- -1: 设备类型未知。
- AUDIO_PLAYOUT_DEVICE
- 0: 音频播放设备。
- AUDIO_RECORDING_DEVICE
- 1: 音频采集设备。
- VIDEO_RENDER_DEVICE
- 2: 视频渲染设备。
- VIDEO_CAPTURE_DEVICE
- 3: 视频采集设备。
- AUDIO_APPLICATION_PLAYOUT_DEVICE
- 4: 音频应用播放设备。
METADATA_TYPE
NETWORK_TYPE
网络连接类型。
枚举值
- NETWORK_TYPE_UNKNOWN
- -1: 网络连接类型未知。
- NETWORK_TYPE_DISCONNECTED
- 0: 网络连接已断开。
- NETWORK_TYPE_LAN
- 1: 网络类型为 LAN。
- NETWORK_TYPE_WIFI
- 2: 网络类型为 Wi-Fi (包含热点)。
- NETWORK_TYPE_MOBILE_2G
- 3: 网络类型为 2G 移动网络。
- NETWORK_TYPE_MOBILE_3G
- 4: 网络类型为 3G 移动网络。
- NETWORK_TYPE_MOBILE_4G
- 5: 网络类型为 4G 移动网络。
ORIENTATION_MODE
视频编码的方向模式。
枚举值
- ORIENTATION_MODE_ADAPTIVE
-
0: (默认)该模式下 SDK 输出的视频方向与采集到的视频方向一致。接收端会根据收到的视频旋转信息对视频进行旋转。该模式适用于接收端可以调整视频方向的场景。
- 如果采集的视频是横屏模式,则输出的视频也是横屏模式。
- 如果采集的视频是竖屏模式,则输出的视频也是竖屏模式。
- ORIENTATION_FIXED_LANDSCAPE
- 1: 该模式下 SDK 固定输出风景(横屏)模式的视频。如果采集到的视频是竖屏模式,则视频编码器会对其进行裁剪。该模式适用于当接收端无法调整视频方向时,如使用旁路推流场景下。
- ORIENTATION_FIXED_PORTRAIT
- 2: 该模式下 SDK 固定输出人像(竖屏)模式的视频,如果采集到的视频是横屏模式,则视频编码器会对其进行裁剪。该模式适用于当接收端无法调整视频方向时,如使用旁路推流场景下。
PRIORITY_TYPE
远端用户的需求优先级。
枚举值
- PRIORITY_HIGH
- 用户需求优先级为高。
- PRIORITY_NORMAL
- (默认)用户需求优先级为正常。
QUALITY_ADAPT_INDICATION
自上次统计后本地视频质量的自适应情况(基于目标帧率和目标码率)。
枚举值
- ADAPT_NONE
- 本地视频质量不变。
- ADAPT_UP_BANDWIDTH
- 因网络带宽增加,本地视频质量改善。
- ADAPT_DOWN_BANDWIDTH
- 因网络带宽减少,本地视频质量变差。
QUALITY_TYPE
网络质量。
枚举值
- QUALITY_UNKNOWN
- 0: 网络质量未知。
- QUALITY_EXCELLENT
- 1: 网络质量极好。
- QUALITY_GOOD
- 2: 用户主观感觉和 excellent 差不多,但码率可能略低于 excellent。
- QUALITY_POOR
- 3: 用户主观感受有瑕疵但不影响沟通。
- QUALITY_BAD
- 4: 勉强能沟通但不顺畅。
- QUALITY_VBAD
- 5: 网络质量非常差,基本不能沟通。
- QUALITY_DOWN
- 6: 完全无法沟通。
- QUALITY_UNSUPPORTED
- 7: 暂时无法检测网络质量(未使用)。
- QUALITY_DETECTING
- 8: 网络质量检测已开始还没完成。
RAW_AUDIO_FRAME_OP_MODE_TYPE
音频数据的使用模式。
枚举值
- RAW_AUDIO_FRAME_OP_MODE_READ_ONLY
- 0: 只读模式,用户仅获取 SDK 返回的原始数据,不作任何修改。例如: 若用户通过 Agora SDK 采集数据,自己进行 RTMP/RTMPS 推流,则可以选择该模式。
- RAW_AUDIO_FRAME_OP_MODE_WRITE_ONLY
- 1: 只写模式,用户替换 SDK 返回的原始视频,并返回给 SDK 进行编码传输。例如: 若用户自行采集数据,可选择该模式。
- RAW_AUDIO_FRAME_OP_MODE_READ_WRITE
- 2: 读写模式, 用户修改 SDK 返回的原始视频,并返回给 SDK 进行编码传输。例如: 若用户自己有音效处理模块,且想要根据实际需要对数据进行前处理(例如变声),则可以选择该模式。
REMOTE_AUDIO_STATE_REASON
远端音频流状态切换原因。
枚举值
- REMOTE_AUDIO_STATE_REASON_INTERNAL
- 0: 音频状态发生改变时,会报告该原因。
- REMOTE_AUDIO_STATE_REASON_NETWORK_CONGESTION
- 1: 网络阻塞。
- REMOTE_AUDIO_STATE_REASON_NETWORK_RECOVERY
- 2: 网络恢复正常。
- REMOTE_AUDIO_STATE_REASON_LOCAL_MUTED
- 3: 本地用户停止接收远端音频流或本地用户禁用音频模块。
- REMOTE_AUDIO_STATE_REASON_LOCAL_UNMUTED
- 4: 本地用户恢复接收远端音频流或本地用户启动音频模块。
- REMOTE_AUDIO_STATE_REASON_REMOTE_MUTED
- 5: 远端用户停止发送音频流或远端用户禁用音频模块。
- REMOTE_AUDIO_STATE_REASON_REMOTE_UNMUTED
- 6: 远端用户恢复发送音频流或远端用户启用音频模块。
- REMOTE_AUDIO_STATE_REASON_REMOTE_OFFLINE
- 7: 远端用户离开频道。
REMOTE_AUDIO_STATE
远端音频流状态。
枚举值
- REMOTE_AUDIO_STATE_STOPPED
- 0: 远端音频默认初始状态。在 REMOTE_AUDIO_STATE_REASON_LOCAL_MUTED、REMOTE_AUDIO_STATE_REASON_REMOTE_MUTED 或 REMOTE_AUDIO_STATE_REASON_REMOTE_OFFLINE的情况下,会报告该状态。
- REMOTE_AUDIO_STATE_STARTING
- 1: 本地用户已接收远端音频首包。
- REMOTE_AUDIO_STATE_DECODING
- 2: 远端音频流正在解码,正常播放。在 REMOTE_AUDIO_STATE_REASON_NETWORK_RECOVERY、REMOTE_AUDIO_STATE_REASON_LOCAL_UNMUTED 或 REMOTE_AUDIO_STATE_REASON_REMOTE_UNMUTED 的情况下, 会报告该状态。
- REMOTE_AUDIO_STATE_FROZEN
- 3: 远端音频流卡顿。在 REMOTE_AUDIO_STATE_REASON_NETWORK_CONGESTION 的情况下,会报告该状态。
- REMOTE_AUDIO_STATE_FAILED
- 4: 远端音频流播放失败。在 REMOTE_AUDIO_STATE_REASON_INTERNAL 的情况下,会报告该状态。
REMOTE_VIDEO_STATE_REASON
远端视频流状态切换原因。
枚举值
- REMOTE_VIDEO_STATE_REASON_INTERNAL
- 0: 视频状态发生改变时,会报告该原因。
- REMOTE_VIDEO_STATE_REASON_NETWORK_CONGESTION
- 1: 网络阻塞。
- REMOTE_VIDEO_STATE_REASON_NETWORK_RECOVERY
- 2: 网络恢复正常。
- REMOTE_VIDEO_STATE_REASON_LOCAL_MUTED
- 3: 本地用户停止接收远端视频流或本地用户禁用视频模块。
- REMOTE_VIDEO_STATE_REASON_LOCAL_UNMUTED
- 4: 本地用户恢复接收远端视频流或本地用户启动视频模块。
- REMOTE_VIDEO_STATE_REASON_REMOTE_MUTED
- 5: 远端用户停止发送视频流或远端用户禁用视频模块。
- REMOTE_VIDEO_STATE_REASON_REMOTE_UNMUTED
- 6: 远端用户恢复发送视频流或远端用户启用视频模块。
- REMOTE_VIDEO_STATE_REASON_REMOTE_OFFLINE
- 7: 远端用户离开频道。
- REMOTE_VIDEO_STATE_REASON_AUDIO_FALLBACK
- 8: 弱网情况下,远端音视频流回退为音频流。
- REMOTE_VIDEO_STATE_REASON_AUDIO_FALLBACK_RECOVERY
- 9: 网络情况改善时,远端音频流恢复为音视频流。
REMOTE_VIDEO_STATE
远端视频流状态。
枚举值
- REMOTE_VIDEO_STATE_STOPPED
- 0: 远端视频默认初始状态。在 REMOTE_VIDEO_STATE_REASON_LOCAL_MUTED、REMOTE_VIDEO_STATE_REASON_REMOTE_MUTED 或 REMOTE_VIDEO_STATE_REASON_REMOTE_OFFLINE 的情况下,会报告该状态。
- REMOTE_VIDEO_STATE_STARTING
- 1: 本地用户已接收远端视频首包。
- REMOTE_VIDEO_STATE_DECODING
- 2: 远端视频流正在解码,正常播放。在 REMOTE_VIDEO_STATE_REASON_NETWORK_RECOVERY、REMOTE_VIDEO_STATE_REASON_LOCAL_UNMUTED、REMOTE_VIDEO_STATE_REASON_REMOTE_UNMUTED 或 REMOTE_VIDEO_STATE_REASON_AUDIO_FALLBACK_RECOVERY 的情况下, 会报告该状态。
- REMOTE_VIDEO_STATE_FROZEN
- 3: 远端视频流卡顿。在 REMOTE_VIDEO_STATE_REASON_NETWORK_CONGESTION 或 REMOTE_VIDEO_STATE_REASON_AUDIO_FALLBACK 的情况下,会报告该状态。
- REMOTE_VIDEO_STATE_FAILED
- 4: 远端视频流播放失败。在 REMOTE_VIDEO_STATE_REASON_INTERNAL 的情况下,会报告该状态。
REMOTE_VIDEO_STREAM_TYPE
视频流类型。
枚举值
- REMOTE_VIDEO_STREAM_HIGH
- 0: 视频大流。
- REMOTE_VIDEO_STREAM_LOW
- 1: 视频小流。
RENDER_MODE
视频渲染模式类型。
枚举值
- WEBGL
- WebGL 渲染。
- SOFTWARE
- 软件渲染。
- CUSTOM
- 自定义渲染。
RTMP_STREAM_PUBLISH_ERROR
推流错误信息。
枚举值
- RTMP_STREAM_PUBLISH_ERROR_OK
- 推流成功。
- RTMP_STREAM_PUBLISH_ERROR_INVALID_ARGUMENT
- 参数无效。请检查输入参数是否正确。例如如果你在调用 addPublishStreamUrl 前没有调用 setLiveTranscoding 设置转码参数,SDK 会返回该错误。
- RTMP_STREAM_PUBLISH_ERROR_ENCRYPTED_STREAM_NOT_ALLOWED
- 推流已加密,不能推流。
- RTMP_STREAM_PUBLISH_ERROR_CONNECTION_TIMEOUT
- 推流超时未成功。可调用 addPublishStreamUrl 重新推流。
- RTMP_STREAM_PUBLISH_ERROR_INTERNAL_SERVER_ERROR
- 推流服务器出现错误。请调用 addPublishStreamUrl 重新推流。
- RTMP_STREAM_PUBLISH_ERROR_RTMP_SERVER_ERROR
- CDN 服务器出现错误。
- RTMP_STREAM_PUBLISH_ERROR_TOO_OFTEN
- 推流请求过于频繁。
- RTMP_STREAM_PUBLISH_ERROR_REACH_LIMIT
- 单个主播的推流地址数目达到上限 10。请删掉一些不用的推流地址再增加推流地址。
- RTMP_STREAM_PUBLISH_ERROR_NOT_AUTHORIZED
- 主播操作不属于自己的流。例如更新其他主播的流参数、停止其他主播的流。请检查 App 逻辑。
- RTMP_STREAM_PUBLISH_ERROR_STREAM_NOT_FOUND
- 服务器未找到这个流。
- RTMP_STREAM_PUBLISH_ERROR_FORMAT_NOT_SUPPORTED
- 推流地址格式有错误。请检查推流地址格式是否正确。
RTMP_STREAM_PUBLISH_STATE
推流状态。
枚举值
- RTMP_STREAM_PUBLISH_STATE_IDLE
- 推流未开始或已结束。成功调用 removePublishStreamUrl 方法删除推流地址后,也会返回该状态。
- RTMP_STREAM_PUBLISH_STATE_CONNECTING
- 正在连接 Agora 推流服务器和 CDN 服务器。调用 addPublishStreamUrl 方法后,会返回该状态。
- RTMP_STREAM_PUBLISH_STATE_RUNNING
- 推流正在进行。成功推流后,会返回该状态。
- RTMP_STREAM_PUBLISH_STATE_RECOVERING
-
正在恢复推流。当 CDN 出现异常,或推流短暂中断时,SDK 会自动尝试恢复推流,并返回该状态。
- 如成功恢复推流,则进入状态 RTMP_STREAM_PUBLISH_STATE_RUNNING(2)。
- 如服务器出错或 60 秒内未成功恢复,则进入状态 RTMP_STREAM_PUBLISH_STATE_FAILURE(4)。如果觉得 60 秒太长,也可以主动调用 removePublishStreamUrl 和 addPublishStreamUrl 方法尝试重连。
- RTMP_STREAM_PUBLISH_STATE_FAILURE
- 推流失败。失败后,你可以通过返回的错误码排查错误原因,也可以再次调用 addPublishStreamUrl 重新尝试推流。
RTMP_STREAMING_EVENT
RTMP/RTMPS 推流时发生的事件。
枚举值
- RTMP_STREAMING_EVENT_FAILED_LOAD_IMAGE
- RTMP/RTMPS 推流时,添加背景图或水印出错。
STREAM_FALLBACK_OPTIONS
音视频流回退处理选项。
枚举值
- STREAM_FALLBACK_OPTION_DISABLED
- 0: 上行/下行网络较弱时,不对音视频流作回退处理,但不能保证音视频流的质量。
- STREAM_FALLBACK_OPTION_VIDEO_STREAM_LOW
- 1: 在下行网络条件较差时只接收视频小流(低分辨率、低码率视频流)。该选项只对 setRemoteSubscribeFallbackOption 有效,对 setLocalPublishFallbackOption 方法无效。
- STREAM_FALLBACK_OPTION_AUDIO_ONLY
- 2: 上行/下行网络较弱时,先尝试只接收视频小流(低分辨率、低码率视频流);如果网络环境无法显示视频,则再回退到只接收远端订阅的音频流。
STREAM_PUBLISH_STATE
发布状态。
枚举值
- PUB_STATE_IDLE
- 0: 加入频道后的初始发布状态。
- PUB_STATE_NO_PUBLISHED
-
1: 发布失败。可能是因为:
- 本地用户调用 muteLocalAudioStream(
true
) 或 muteLocalVideoStream(true
) 停止发送本地媒体流。 - 本地用户调用 disableAudio 或 disableVideo 关闭本地音频或视频模块。
- 本地用户调用 enableLocalAudio(
false
) 或 enableLocalVideo(false
) 关闭本地音频或视频采集。 - 本地用户角色为观众。
- 本地用户调用 muteLocalAudioStream(
- PUB_STATE_PUBLISHING
- 2: 正在发布。
- PUB_STATE_PUBLISHED
- 3: 发布成功。
STREAM_SUBSCRIBE_STATE
订阅状态。
枚举值
- SUB_STATE_IDLE
- 0: 加入频道后的初始订阅状态。
- SUB_STATE_NO_SUBSCRIBED
-
1: 订阅失败。可能是因为:
- 远端用户:
- 调用 muteLocalAudioStream(
true
) 或 muteLocalVideoStream(true
) 停止发送本地媒体流。 - 调用 disableAudio 或 disableVideo 关闭本地音频或视频模块。
- 调用 enableLocalAudio(false) 或 enableLocalVideo(false) 关闭本地音频或视频采集。
- 用户角色为观众。
- 调用 muteLocalAudioStream(
- 本地用户调用以下方法停止接收远端媒体流:
- 调用 muteRemoteAudioStream(true)、 muteAllRemoteAudioStreams(true) 或 setDefaultMuteAllRemoteAudioStreams(true) 停止接收远端音频流。
- 调用 muteRemoteVideoStream(true)、 muteAllRemoteVideoStreams(true) 或 setDefaultMuteAllRemoteVideoStreams(true) 停止接收远端视频流。
- 远端用户:
- SUB_STATE_SUBSCRIBING
- 2: 正在订阅。
- SUB_STATE_SUBSCRIBED
- 3: 收到了远端流,订阅成功。
USER_OFFLINE_REASON_TYPE
用户离线原因。
枚举值
- USER_OFFLINE_QUIT
- 0: 用户主动离开。
- USER_OFFLINE_DROPPED
1: 因过长时间收不到对方数据包,超时掉线。
注意: 由于 SDK 使用的是不可靠通道,也有可能对方主动离开频道,但是本地没收到对方离开消息而误判为超时掉线。- USER_OFFLINE_BECOME_AUDIENCE
- 2: 用户身份从主播切换为观众。
VIDEO_CODEC_PROFILE_TYPE
旁路推流输出视频的编解码规格。
- VIDEO_CODEC_PROFILE_BASELINE
- 66: Baseline 级别的视频编码规格,一般用于低阶或需要额外容错的应用,比如视频通话、手机视频等。
- VIDEO_CODEC_PROFILE_MAIN
- 77: Main 级别的视频编码规格,一般用于主流消费类电子产品,如 MP4、便携的视频播放器、PSP、iPad 等。
- VIDEO_CODEC_PROFILE_HIGH
- 100: (默认)High 级别的视频编码规格,一般用于广播、视频碟片存储、高清电视。
VIDEO_CODEC_TYPE_FOR_STREAM
转码输出视频流的编解码类型。
枚举值
- VIDEO_CODEC_H264_FOR_STREAM
- 1:(默认)H.264。
- VIDEO_CODEC_H265_FOR_STREAM
- 2:H.265。
VIDEO_CODEC_TYPE
视频编码格式。
枚举值
- VIDEO_CODEC_VP8
- 标准 VP8。
- VIDEO_CODEC_H264
- 标准 H.264。
- VIDEO_CODEC_EVP
- 增强 VP8。
- VIDEO_CODEC_E264
- 增强 H.264。
VideoContentHint
屏幕共享的内容类型。
枚举值
- CONTENT_HINT_NONE
- (默认)无指定的内容类型。
- CONTENT_HINT_MOTION
- 内容类型为动画。当共享的内容是视频、电影或视频游戏时,推荐选择该内容类型。
- CONTENT_HINT_DETAILS
- 内容类型为细节。当共享的内容是图片或文字时,推荐选择该内容类型。
VIDEO_MIRROR_MODE_TYPE
镜像模式类型。
枚举值
- VIDEO_MIRROR_MODE_AUTO
- 0:(默认)由 SDK 决定镜像模式。
- VIDEO_MIRROR_MODE_ENABLED
- 1: 启用镜像模式。
- VIDEO_MIRROR_MODE_DISABLED
- 2: 关闭镜像模式。
VIDEO_PROFILE_TYPE
视频属性。
- 弃用
枚举值
- VIDEO_PROFILE_LANDSCAPE_120P
- 0:分辨率 160 × 120,帧率 15 fps,码率 65 Kbps。
- VIDEO_PROFILE_LANDSCAPE_120P_3
- 2:分辨率 120 × 120,帧率 15 fps,码率 50 Kbps。
- VIDEO_PROFILE_LANDSCAPE_180P
- 10:分辨率 320 × 180,帧率 15 fps,码率 140 Kbps。
- VIDEO_PROFILE_LANDSCAPE_180P_3
- 12:分辨率 180 × 180,帧率 15 fps,码率 100 Kbps。
- VIDEO_PROFILE_LANDSCAPE_180P_4
- 13:分辨率 240 × 180,帧率 15 fps,码率 120 Kbps。
- VIDEO_PROFILE_LANDSCAPE_240P
- 20:分辨率 320 × 240,帧率 15 fps,码率 200 Kbps。
- VIDEO_PROFILE_LANDSCAPE_240P_3
- 22:分辨率 240 × 240,帧率 15 fps,码率 140 Kbps。
- VIDEO_PROFILE_LANDSCAPE_240P_4
- 23:分辨率 424 × 240,帧率 15 fps,码率 220 Kbps。
- VIDEO_PROFILE_LANDSCAPE_360P
- 30:分辨率 640 × 360,帧率 15 fps,码率 400 Kbps。
- VIDEO_PROFILE_LANDSCAPE_360P_3
- 32:分辨率 360 × 360,帧率 15 fps,码率 260 Kbps。
- VIDEO_PROFILE_LANDSCAPE_360P_4
- 33:分辨率 640 × 360,帧率 30 fps,码率 600 Kbps。
- VIDEO_PROFILE_LANDSCAPE_360P_6
- 35:分辨率 360 × 360,帧率 30 fps,码率 400 Kbps。
- VIDEO_PROFILE_LANDSCAPE_360P_7
- 36:分辨率 480 × 360,帧率 15 fps,码率 320 Kbps。
- VIDEO_PROFILE_LANDSCAPE_360P_8
- 37:分辨率 480 × 360,帧率 30 fps,码率 490 Kbps。
- VIDEO_PROFILE_LANDSCAPE_360P_9
-
38:分辨率 640 × 360,帧率 15 fps,码率 800 Kbps。
注意: 该视频属性仅适用于直播频道场景。 - VIDEO_PROFILE_LANDSCAPE_360P_10
39:分辨率 640 × 360,帧率 24 fps,码率 800 Kbps。
注意: 该视频属性仅适用于直播频道场景。- VIDEO_PROFILE_LANDSCAPE_360P_11
100: 分辨率 640 × 360,帧率 24 fps,码率 1000 Kbps。
注意: 该视频属性仅适用于直播频道场景。- VIDEO_PROFILE_LANDSCAPE_480P
- 40:分辨率 640 × 480,帧率 15 fps,码率 500 Kbps。
- VIDEO_PROFILE_LANDSCAPE_480P_3
- 42:分辨率 480 × 480,帧率 15 fps,码率 400 Kbps。
- VIDEO_PROFILE_LANDSCAPE_480P_4
- 43:分辨率 640 × 480,帧率 30 fps,码率 750 Kbps。
- VIDEO_PROFILE_LANDSCAPE_480P_6
- 45:分辨率 480 × 480,帧率 30 fps,码率 600 Kbps。
- VIDEO_PROFILE_LANDSCAPE_480P_8
- 47:分辨率 848 × 480,帧率 15 fps,码率 610 Kbps。
- VIDEO_PROFILE_LANDSCAPE_480P_9
- 48:分辨率 848 × 480,帧率 30 fps,码率 930 Kbps。
- VIDEO_PROFILE_LANDSCAPE_480P_10
- 49:分辨率 640 × 480,帧率 10 fps,码率 400 Kbps。
- VIDEO_PROFILE_LANDSCAPE_720P
- 50:分辨率 1280 × 720,帧率 15 fps,码率 1130 Kbps。
- VIDEO_PROFILE_LANDSCAPE_720P_3
- 52:分辨率 1280 × 720,帧率 30 fps,码率 1710 Kbps。
- VIDEO_PROFILE_LANDSCAPE_720P_5
- 54:分辨率 960 × 720,帧率 15 fps,码率 910 Kbps。
- VIDEO_PROFILE_LANDSCAPE_720P_6
- 55:分辨率 960 × 720,帧率 30 fps,码率 1380 Kbps。
- VIDEO_PROFILE_LANDSCAPE_1080P
- 60:分辨率 1920 × 1080,帧率 15 fps,码率 2080 Kbps。
- VIDEO_PROFILE_LANDSCAPE_1080P_3
- 62:分辨率 1920 × 1080,帧率 30 fps,码率 3150 Kbps。
- VIDEO_PROFILE_LANDSCAPE_1080P_5
- 64:分辨率 1920 × 1080,帧率 60 fps,码率 4780 Kbps。
- VIDEO_PROFILE_PORTRAIT_120P
- 1000: 分辨率 120 × 160,帧率 15 fps,码率 65 Kbps。
- VIDEO_PROFILE_PORTRAIT_120P_3
- 1002: 分辨率 120 × 120,帧率 15 fps,码率 50 Kbps。
- VIDEO_PROFILE_PORTRAIT_180P
- 1010: 分辨率 180 × 320,帧率 15 fps,码率 140 Kbps。
- VIDEO_PROFILE_PORTRAIT_180P_3
- 1012: 分辨率 180 × 180,帧率 15 fps,码率 100 Kbps。
- VIDEO_PROFILE_PORTRAIT_180P_4
- 1013: 分辨率 180 × 240,帧率 15 fps,码率 120 Kbps。
- VIDEO_PROFILE_PORTRAIT_240P
- 1020: 分辨率 240 × 320,帧率 15 fps,码率 200 Kbps。
- VIDEO_PROFILE_PORTRAIT_240P_3
- 1022: 分辨率 240 × 240,帧率 15 fps,码率 140 Kbps。
- VIDEO_PROFILE_PORTRAIT_240P_4
- 1023: 分辨率 240 × 424,帧率 15 fps,码率 220 Kbps。
- VIDEO_PROFILE_PORTRAIT_360P
- 1030: 分辨率 360 × 640,帧率 15 fps,码率 400 Kbps。
- VIDEO_PROFILE_PORTRAIT_360P_3
- 1032: 分辨率 360 × 360,帧率 15 fps,码率 260 Kbps。
- VIDEO_PROFILE_PORTRAIT_360P_4
- 1033: 分辨率 360 × 640,帧率 30 fps,码率 600 Kbps。
- VIDEO_PROFILE_PORTRAIT_360P_6
- 1035: 分辨率 360 × 360,帧率 30 fps,码率 400 Kbps。
- VIDEO_PROFILE_PORTRAIT_360P_7
- 1036: 分辨率 360 × 480,帧率 15 fps,码率 320 Kbps。
- VIDEO_PROFILE_PORTRAIT_360P_8
- 1037: 分辨率 360 × 480,帧率 30 fps,码率 490 Kbps。
- VIDEO_PROFILE_PORTRAIT_360P_9
-
1038: 分辨率 360 × 640,帧率 15 fps,码率 800 Kbps。
注意: 该视频属性仅适用于直播频道场景。 - VIDEO_PROFILE_PORTRAIT_360P_10
-
1039: 分辨率 360 × 640,帧率 24 fps,码率 800 Kbps。
注意: 该视频属性仅适用于直播频道场景。 - VIDEO_PROFILE_PORTRAIT_360P_11
-
1100: 分辨率 360 × 640,帧率 24 fps,码率 1000 Kbps。
注意: 该视频属性仅适用于直播频道场景。 - VIDEO_PROFILE_PORTRAIT_480P
- 1040: 分辨率 480 × 640,帧率 15 fps,码率 500 Kbps。
- VIDEO_PROFILE_PORTRAIT_480P_3
- 1042: 分辨率 480 × 480,帧率 15 fps,码率 400 Kbps。
- VIDEO_PROFILE_PORTRAIT_480P_4
- 1043: 分辨率 480 × 640,帧率 30 fps,码率 750 Kbps。
- VIDEO_PROFILE_PORTRAIT_480P_6
- 1045: 分辨率 480 × 480,帧率 30 fps,码率 600 Kbps。
- VIDEO_PROFILE_PORTRAIT_480P_8
- 1047: 分辨率 480 × 848,帧率 15 fps,码率 610 Kbps。
- VIDEO_PROFILE_PORTRAIT_480P_9
- 1048: 分辨率 480 × 848,帧率 30 fps,码率 930 Kbps。
- VIDEO_PROFILE_PORTRAIT_480P_10
- 1049: 分辨率 480 × 640,帧率 10 fps,码率 400 Kbps。
- VIDEO_PROFILE_PORTRAIT_720P
- 1050: 分辨率 分辨率 720 × 1280,帧率 15 fps,码率 1130 Kbps。
- VIDEO_PROFILE_PORTRAIT_720P_3
- 1052: 分辨率 分辨率 720 × 1280,帧率 30 fps,码率 1710 Kbps。
- VIDEO_PROFILE_PORTRAIT_720P_5
- 1054: 分辨率 720 × 960,帧率 15 fps,码率 910 Kbps。
- VIDEO_PROFILE_PORTRAIT_720P_6
- 1055: 分辨率 720 × 960,帧率 30 fps,码率 1380 Kbps。
- VIDEO_PROFILE_PORTRAIT_1080P
- 1060: 分辨率 1080 × 1920,帧率 15 fps,码率 2080 Kbps。
- VIDEO_PROFILE_PORTRAIT_1080P_3
- 1062: 分辨率 1080 × 1920,帧率 30 fps,码率 3150 Kbps。
- VIDEO_PROFILE_PORTRAIT_1080P_5
- 1064: 分辨率 1080 × 1920,帧率 60 fps,码率 4780 Kbps。
- VIDEO_PROFILE_DEFAULT
- (默认)分辨率 640 × 360,帧率 15 fps,码率 400 Kbps。
VOICE_BEAUTIFIER_PRESET
预设的美声效果选项。
枚举值
- VOICE_BEAUTIFIER_OFF
- 原声,即关闭美声效果。
- CHAT_BEAUTIFIER_MAGNETIC
磁性(男)。
注意: 该设置仅对男声有效。请勿用于设置女声,否则音频会失真。- CHAT_BEAUTIFIER_FRESH
-
清新(女)。
注意: 该设置仅对女声有效。请勿用于设置男声,否则音频会失真。 - CHAT_BEAUTIFIER_VITALITY
-
活力(女)。
注意: 该设置仅对女声有效。请勿用于设置男声,否则音频会失真。 - SINGING_BEAUTIFIER
-
- 自从
- v3.3.0
歌唱美声。
- 如果调用 setVoiceBeautifierPreset(SINGING_BEAUTIFIER), 你可以美化男声并添加歌声在小房间的混响效果。请勿用于设置女声,否则音频会失真。
- 如果调用 setVoiceBeautifierParameters(SINGING_BEAUTIFIER, param1, param2), 你可以美化男声或女声并添加混响效果。
- TIMBRE_TRANSFORMATION_VIGOROUS
- 浑厚。
- TIMBRE_TRANSFORMATION_DEEP
- 低沉。
- TIMBRE_TRANSFORMATION_MELLOW
- 圆润。
- TIMBRE_TRANSFORMATION_FALSETTO
- 假音。
- TIMBRE_TRANSFORMATION_FULL
- 饱满。
- TIMBRE_TRANSFORMATION_CLEAR
- 清澈。
- TIMBRE_TRANSFORMATION_RESOUNDING
- 高亢。
- TIMBRE_TRANSFORMATION_RINGING
- 嘹亮。
VOICE_CHANGER_PRESET
预设的语音变声效果。
- 弃用
- 自 v3.2.0 废弃。
枚举值
- VOICE_CHANGER_OFF
- 原声,即关闭语音变声。
- VOICE_CHANGER_OLDMAN
- 变声:老男人。
- VOICE_CHANGER_BABYBOY
- 变声:小男孩。
- VOICE_CHANGER_BABYGIRL
- 变声:小女孩。
- VOICE_CHANGER_ZHUBAJIE
- 变声:猪八戒。
- VOICE_CHANGER_ETHEREAL
- 变声:空灵。
- VOICE_CHANGER_HULK
- 变声:绿巨人。
- VOICE_BEAUTY_VIGOROUS
- 美音:浑厚。
- VOICE_BEAUTY_DEEP
- 美音:深沉。
- VOICE_BEAUTY_MELLOW
- 美音:圆润。
- VOICE_BEAUTY_FALSETTO
- 美音:假音。
- VOICE_BEAUTY_FULL
- 美音:饱满。
- VOICE_BEAUTY_CLEAR
- 美音:清澈。
- VOICE_BEAUTY_RESOUNDING
- 美音:高亢。
- VOICE_BEAUTY_RINGING
- 美音:嘹亮。
- VOICE_BEAUTY_SPACIAL
- 美音:空旷。
- GENERAL_BEAUTY_VOICE_MALE_MAGNETIC
- 语聊美声:磁性(男)。此枚举为男声定制化效果,不适用于女声。若女声使用此音效设置,则音频可能会产生失真。
- GENERAL_BEAUTY_VOICE_FEMALE_FRESH
- 语聊美声:清新(女)。此枚举为女声定制化效果,不适用于男声。若男声使用此音效设置,则音频可能会产生失真。
- GENERAL_BEAUTY_VOICE_FEMALE_VITALITY
- 语聊美声:活力(女)。此枚举为女声定制化效果,不适用于男声。若男声使用此音效设置,则音频可能会产生失真。
VOICE_CONVERSION_PRESET
预设的变声效果选项。
- 自从
- v3.3.1
枚举值
- VOICE_CONVERSION_OFF
- 原声,即关闭变声效果。
- VOICE_CHANGER_NEUTRAL
- 中性。为避免音频失真,请确保仅对女声设置该效果。
- VOICE_CHANGER_SWEET
- 甜美。为避免音频失真,请确保仅对女声设置该效果。
- VOICE_CHANGER_SOLID
- 稳重。为避免音频失真,请确保仅对男声设置该效果。
- VOICE_CHANGER_BASS
- 低沉。为避免音频失真,请确保仅对男声设置该效果。
AudioRecordingConfiguration
客户端录音配置。
export interface AudioRecordingConfiguration { filePath: string; recordingQuality: AUDIO_RECORDING_QUALITY_TYPE; recordingPosition: AUDIO_RECORDING_POSITION; recordingSampleRate: number; }
属性
- filePath
-
录音文件在本地保存的绝对路径,需精确到文件名及格式。例如:
C:\music\audio.aac
。注: 请确保你指定的路径存在并且可写。 - recordingQuality
录音音质。详见 AUDIO_RECORDING_QUALITY_TYPE。
注意: 该参数仅适用于 AAC 文件。- recordingPosition
- 录音内容。详见 AUDIO_RECORDING_POSITION。
- recordingSampleRate
- 录音采样率 (Hz)。
- 16000
- (默认)32000
- 44100
- 48000
注意: 如果把该参数设为 44100 或 48000,为保证录音效果,Agora 推荐录制 WAV 文件 或 recordingQuality 为 AUDIO_RECORDING_QUALITY_MEDIUM 或 AUDIO_RECORDING_QUALITY_HIGH 的 AAV 文件。
AudioVolumeInfo
用户音量信息。
export interface AudioVolumeInfo { uid: number, volume: number vad: number channelId: string }
属性
- uid
-
用户 ID。
- 在本地用户的回调中,uid 为 0。
- 在远端用户的回调中,uid 为瞬时音量最高的远端用户(最多 3 位)的 ID。
- volume
- 用户的音量,取值范围为 [0,255]。如果用户调用了 startAudioMixing,则 volume 为用户混音后的音量。
- vad
-
本地用户的人声状态。
- 0:本地无人声。
- 1:本地有人声。
注意:- vad 无法报告远端用户的人声状态。对于远端用户,vad 的值始终为 0。
- 如需使用此参数,请在调用 enableAudioVolumeIndication 时设置 report_vad 为
true
。
- channelId
- 用户所在频道的频道名称。
BeautyOptions
美颜选项。
export interface BeautyOptions { lighteningContrastLevel: LIGHTENING_CONTRAST_LEVEL; lighteningLevel: number; smoothnessLevel: number; rednessLevel: number; }
属性
- lighteningContrastLevel
- 亮度明暗对比度。详见 LIGHTENING_CONTRAST_LEVEL。
- lighteningLevel
- 亮度,取值范围为 [0.0,1.0],其中 0.0 表示原始亮度。可用来实现美白等视觉效果。
- smoothnessLevel
- 平滑度,取值范围为 [0.0,1.0],其中 0.0 表示原始平滑等级。可用来实现祛痘、磨皮等视觉效果。
- rednessLevel
- 红色度,取值范围为 [0.0,1.0],其中 0.0 表示原始红色度。可用来实现红润肤色等视觉效果。
CameraCapturerConfiguration
摄像头采集配置。
export interface CameraCapturerConfiguration { preference?: CAPTURER_OUTPUT_PREFERENCE; captureWidth?: number; captureHeight?: number; }
属性
- preference
- 摄像头采集偏好。详见 CAPTURER_OUTPUT_PREFERENCE。
- captureWidth
-
- 自从
- v3.3.1
本地采集的视频宽度 (px)。如果你需要自定义本地采集的视频宽度,请先将 preference 设为 CAPTURER_OUTPUT_PREFERENCE_MANUAL(3),再通过 captureWidth 设置采集的视频宽度。
- captureHeight
-
- 自从
- v3.3.1
本地采集的视频高度 (px)。如果你需要自定义本地采集的视频高度,请先将 preference 设为 CAPTURER_OUTPUT_PREFERENCE_MANUAL(3),再 通过 captureHeight 设置采集的视频高度。
Channel
频道信息。
export type Channel = "" | string;
- ""。
- 字符串。
ChannelMediaInfo
ChannelMediaInfo 类定义。
export interface ChannelMediaInfo { channelName: string; token: string; uid: number; }
属性
- channelName
- 频道名。
- token
- 能加入频道的 Token。
- uid
- 用户 ID。
ChannelMediaOptions
频道媒体设置选项。
export interface ChannelMediaOptions { autoSubscribeAudio: boolean; autoSubscribeVideo: boolean; }
- 自从
- v3.0.0
属性
- autoSubscribeAudio
- 是否自动订阅频道内所有远端音频流:
true
:(默认)订阅。false
: 不订阅。
- audioSubscribeVideo
- 是否自动订阅频道内所有远端视频流:
true
:(默认)订阅。false
: 不订阅。
ChannelMediaRelayConfiguration
ChannelMediaRelayConfiguration 类定义。
export interface ChannelMediaRelayConfiguration { srcInfo: ChannelMediaInfo; destInfos: [ChannelMediaInfo]; }
属性
- srcInfo
-
源频道信息 ChannelMediaInfo,包含如下成员:
channelName
:源频道名。默认值为null
,表示 SDK 填充当前的频道名。uid
:标识源频道中的转发媒体流的 UID。默认值为 0,表示 SDK 随机分配一个uid
。请确保设为 0。token
:能加入源频道的token
。由你在srcInfo
中设置的channelName
和uid
生成。- 如未启用 App Certificate,可直接将该参数设为默认值
null
,表示 SDK 填充 App ID。 - 如已启用 App Certificate,则务必填入使用
channelName
和uid
生成的token
,且其中的uid
必须为 0。
- 如未启用 App Certificate,可直接将该参数设为默认值
- destInfos
-
目标频道信息 ChannelMediaInfo,包含如下成员:
channelName
:目标频道的频道名。uid
:标识目标频道中的转发媒体流的 UID。取值范围为 0 到(232-1),请确保与目标频道中的所有 UID 不同。默认值为 0,表示 SDK 随机分配一个 UID。请确保不要将该参数设为目标频道的主播的 UID,并与目标频道中的所有 UID 都不同。token
:能加入目标频道的token
。由你在destInfos
中设置的channelName
和uid
生成。- 如未启用 App Certificate,可直接将该参数设为默认值
null
,表示 SDK 填充 App ID。 - 如已启用 App Certificate,则务必填入使用
channelName
和uid
生成的token
。
- 如未启用 App Certificate,可直接将该参数设为默认值
- destCount
- 目标频道数量,默认值为 0,取值范围为 [0,4]。该参数应与你在
destInfo
中定义的 ChannelMediaInfo 数组的数目一致。
ClientRoleOptions
用户角色具体设置。
export interface ClientRoleOptions { audienceLatencyLevel: AUDIENCE_LATENCY_LEVEL_TYPE; }
属性
- audienceLatencyLevel
- 观众端延时级别。详见 AUDIENCE_LATENCY_LEVEL_TYPE。
DataStreamConfig
数据流设置。
export interface DataStreamConfig { syncWithAudio: boolean; ordered: boolean; }
下表展示不同的参数设置下,SDK 的行为:
syncWithAudio |
ordered |
SDK 行为 |
---|---|---|
false |
false |
接收端接收到数据包后,SDK 立刻触发 STREAM_MESSAGE 回调。 |
true |
false |
如果数据包的延迟在音频延迟的范围内,SDK 会在播放音频的同时触发与该音频包同步的 STREAM_MESSAGE 回调。如果数据包的延迟超出了音频延迟,SDK 会在接收到该数据包时立刻触发 STREAM_MESSAGE 回调;此情况会造成音频包和数据包的不同步。 |
false |
true |
如果数据包的延迟在 5 秒以内,SDK 会修正数据包的乱序问题。如果数据包的延迟超出 5 秒,SDK 会丢弃该数据包。 |
true |
true |
如果数据包的延迟在音频延迟的范围内,SDK 会修正数据包的乱序问题。如果数据包的延迟超出音频延迟,SDK 会丢弃该数据包。 |
属性
- syncWithAudio
-
是否与本地发送的音频流同步。
true
: 数据流与音频流同步。false
: 数据流与音频流不同步。
- ordered
-
是否保证接收到的数据按发送的顺序排列。
true
: 保证 SDK 按照发送方发送的顺序输出数据包。false
: 不保证 SDK 按照发送方发送的顺序输出数据包。
true
。
Device
设备信息。
export interface Device { deviceId: string; deviceName: string; }
属性
- deviceId
- 设备 ID。
- deviceName
- 设备名称。
EncryptionConfig
配置内置加密模式和密钥。
export interface EncryptionConfig { encryptionMode: ENCRYPTION_MODE; encryptionKey: string; }
属性
- encryptionMode
- 内置加密模式,默认为
AES_128_XTS
加密模式。详见 ENCRYPTION_MODE。 - encryptionKey
-
内置加密密钥,字符串类型。
注意: 如果未指定该参数或将该参数设置为null
,则无法启用内置加密,且 SDK 会返回错误码ERR_INVALID_ARGUMENT
(-2)。
InjectStreamConfig
输入外部音视频流的配置。
export interface InjectStreamConfig { width: number; height: number; videoBitrate: number; videoFramerate: number; videoGop: number; audioSampleRate: AUDIO_SAMPLE_RATE_TYPE; audioBitrate: number; audioChannels: number; }
属性
- width
- 外部视频流输入后的宽度。默认值为 0,即保留视频原始宽度。
- height
- 外部视频流输入后的高度。默认值为 0,即保留视频原始高度。
- videoGop
- 外部视频流输入的 GOP(帧)。默认值为 30 帧。
- videoFramerate
- 外部视频流输入的帧率(fps)。默认值为 15 fps。
- videoBitrate
-
外部视频流输入的码率(Kbps)。默认设置为 400 Kbps。
注意: 视频码率的设置与分辨率相关。如果设置的视频码率超出合理范围,SDK 会按照合理区间自动设置码率。 - audioSampleRate
外部音频流输入的采样率。默认值为 48000 Hz。详见 AUDIO_SAMPLE_RATE_TYPE。
注意: 声网建议目前采用默认值,不要自行设置。- audioBitrate
-
外部音频流输入的码率(Kbps)。默认值为 48 Kbps。
注意: 声网建议目前采用默认值,不要自行设置。 - audioChannels
-
外部音频流输入后的频道数。
- 1: 单声道(默认)
- 2: 双声道
注意: 声网建议目前采用默认值,不要自行设置。
LastmileProbeConfig
Last mile 网络探测配置。
export interface LastmileProbeConfig { probeUplink: boolean; probeDownlink: boolean; expectedUplinkBitrate: number; expectedDownlinkBitrate: number; }
属性
- probeUplink
- 是否探测上行网络。有些用户,如直播频道中的普通观众,不需要进行网络探测:
true
: 探测。false
: 不探测。
- probeDownlink
-
是否探测下行网络。
true
: 探测。false
: 不探测。
- expectedUplinkBitrate
- 用户期望的最高发送码率,单位为 bps,范围为 [100000,5000000]。Agora 推荐参考 setVideoEncoderConfiguration 中的码率值设置该参数的值。
- expectedDownlinkBitrate
- 用户期望的最高接收码率,单位为 bps,范围为 [100000,5000000]。
LastmileProbeOneWayResult
上行或下行 Last mile 网络质量探测结果。
export interface LastmileProbeOneWayResult { packetLossRate: number; jitter: number; availableBandwidth: number; }
属性
- packetLossRate
- 丢包率。
- jitter
- 网络抖动 (ms)。
- availableBandwidth
- 可用网络带宽预估 (bps)。
LastmileProbeResult
上下行 Last mile 网络质量探测结果。
export interface LastmileProbeResult { state: LASTMILE_PROBE_RESULT_STATE; uplinkReport: LastmileProbeOneWayResult; downlinkReport: LastmileProbeOneWayResult; rtt: number; }
属性
- state
- Last mile 质量探测结果的状态。详见: LASTMILE_PROBE_RESULT_STATE 。
- uplinkReport
- 上行网络质量报告。详见 LastmileProbeOneWayResult。
- downlinkReport
- 下行网络质量报告。详见 LastmileProbeOneWayResult。
- rtt
- 往返时延 (ms)。
LiveTranscoding
CDN 直播推流的转码属性。
export interface LiveTranscoding { width: number; height: number; videoBitrate: number; videoFrameRate: number; lowLatency: boolean; videoGop: number; videoCodecProfile: VIDEO_CODEC_PROFILE_TYPE; videoCodecType: VIDEO_CODEC_TYPE_FOR_STREAM; backgroundColor: number; userCount: number; audioSampleRate: number; audioChannels: number; audioCodecProfile: AUDIO_CODEC_PROFILE_TYPE; audioBitrate: number; transcodingExtraInfo: string; metadata?: string; watermark: RtcImage; backgroundImage: RtcImage; transcodingUsers: Array<TranscodingUser> }
属性
- width
-
输出媒体流的宽,单位为像素。默认值为 360。
- 如果输出视频流,
width
的值不得低于 64,否则 Agora 会调整为 64。 - 如果输出纯音频流,请将
width
设为 0。
- 如果输出视频流,
- height
-
输出媒体流的高,单位为像素。默认值为 640。
- 如果输出视频流,
height
的值不得低于 64,否则 Agora 会调整为 64。 - 如果输出纯音频流,请将
height
设为 0。
- 如果输出视频流,
- videoBitrate
- 输出媒体流的视频码率(Kbps)。默认值为 400。你可以参考 推流到 CDN 设置该参数的值。
- videoFrameRate
- 输出媒体流的视频帧率(fps)。默认值为 15,取值范围是 [1,30]。 注意: Agora 服务器会将高于 30 fps 的帧率统一调整为 30 fps。
- lowLatency
-
- 弃用
- 该属性自 v2.8.0 起废弃,Agora 不推荐使用。
- true: 低延时,不保证画质。
- false:(默认值)高延时,保证画质。
- videoGop
- 输出媒体流的视频 GOP(Group of Pictures)。默认值为 30。
- videoCodecProfile
-
输出媒体流的视频编码规格,详见 VIDEO_CODEC_PROFILE_TYPE。
注意: 如果你把这个参数设为其他值,Agora 服务器会将其调整为默认值。 - videoCodecType
- 输出视频的编解码类型。详见 VIDEO_CODEC_TYPE_FOR_STREAM。
- backgroundColor
- 输出媒体流的视频背景色。格式为 RGB 定义下的十六进制整数,不要带 # 号。如
0xFFB6C1
表示浅粉色。默认值为0x000000
,表示黑色。 - userCount
- 参与转码合流的主播数量。默认值为 0。
- transcodingUsers
-
参与转码合流的每个主播的设置。Agora 频道内最多支持 17 个主播。详见 TranscodingUser。
- transcodingExtraInfo
- 输出媒体流中嵌入的用户 SEI 信息。用于向 CDN 推送 SEI 信息。长度限制 4096 字节。详见 SEI 帧相关问题。
- metadata
-
- 弃用:
- 该属性已废弃。
- watermark
- 输出媒体流的视频水印。必须为 PNG 格式。详见 RtcImage。
- backgroundImage
- 输出媒体流的视频背景图。详见 RtcImage。
- audioSampleRate
- 输出媒体流的音频采样率 (Hz),详见 AUDIO_SAMPLE_RATE_TYPE。
- audioBitrate
- 输出媒体流的音频码率 (Kbps)。默认值为 48,最大值为 128。
- audioChannels
- 输出媒体流的音频声道数。默认值为 1。建议取值为 1 或 2。
- 1: (默认)单声道
- 2: 双声道
- 3: 三声道
- 4: 四声道
- 5: 五声道
- audioCodecProfile
- 输出媒体流的音频编码规格。详见 AUDIO_CODEC_PROFILE_TYPE。
LocalAudioStats
本地音频统计数据。
export interface LocalAudioStats { numChannels: number; sentSampleRate: number; sentBitrate: number; txPacketLossRate: number; }
属性
- numChannels
- 声道数。
- sentSampleRate
- 发送本地音频的采样率,单位为 Hz。
- sentBitrate
- 发送本地音频的码率平均值,单位为 Kbps。
- txPacketLossRate
- 弱网对抗前本端到 Agora 边缘服务器的丢包率 (%)。
LocalVideoStats
本地视频流统计信息。
export interface LocalVideoStats { sentBitrate: number; sentFrameRate: number; encoderOutputFrameRate: number; rendererOutputFrameRate: number; targetBitrate: number; targetFrameRate: number; qualityAdaptIndication: QUALITY_ADAPT_INDICATION; encodedBitrate: number; encodedFrameWidth: number; encodedFrameHeight: number; encodedFrameCount: number; codecType: VIDEO_CODEC_TYPE; txPacketLossRate: number; captureFrameRate: number; captureBrightnessLevel: CAPTURE_BRIGHTNESS_LEVEL_TYPE; }
属性
- sentBitrate
-
实际发送码率 (Kbps)。注意: 不包含丢包后重传视频等的发送码率。
- sentFrameRate
- 实际发送帧率 (Kbps)。注意: 不包含丢包后重传视频等的发送帧率。
- encoderOutputFrameRate
- 本地视频编码器的输出帧率,单位为 fps。
- rendererOutputFrameRate
- 本地视频渲染器的输出帧率,单位为 fps。
- targetBitrate
- 当前编码器的目标编码码率 (Kbps),该码率为 SDK 根据当前网络状况预估的一个值。
- targetFrameRate
- 当前编码器的目标编码帧率 (fps)。
- qualityAdaptIndication
- 统计周期内本地视频质量(基于目标帧率和目标码率)的自适应情况。详见 QUALITY_ADAPT_INDICATION。
- encodedBitrate
-
视频编码码率(Kbps)。注意: 不包含丢包后重传视频等的编码码率。
- encodedFrameWidth
- 视频编码宽度(px)。
- encodedFrameHeight
- 视频编码高度(px)。
- encodedFrameCount
- 视频发送的帧数,累计值。
- codecType
- 视频的编码类型,详见 VIDEO_CODEC_TYPE。
- txPacketLossRate
- 弱网对抗前本端到 Agora 边缘服务器的视频丢包率 (%)。
- captureFrameRate
- 本地视频采集帧率 (fps)。
- captureBrightnessLevel
-
- 自从
- v3.3.0
本地采集的画质亮度级别。详见 CAPTURE_BRIGHTNESS_LEVEL_TYPE。
LogConfig
Agora SDK 日志文件的配置。
export interface LogConfig { filePath: string, fileSize: number, level: LOG_LEVEL }
- 自从
- v3.3.0
属性
- filePath
-
日志文件的完整路径。请确保你指定的目录存在且可写。你可以通过该参数修改日志文件名。
默认路径为:- macOS:
- 开启沙盒: App Sandbox/Library/Logs/agorasdk.log,例如 /Users/<username>/Library/Containers/<App Bundle Identifier>/Data/Library/Logs/agorasdk.log。
- 关闭沙盒: ~/Library/Logs/agorasdk.log
- Windows: C:\Users\<user_name>\AppData\Local\Agora\<process_name>\agorasdk.log。
- macOS:
- fileSize
- 单个日志文件的大小,单位为 KB。默认值为 2014 KB。如果你将 fileSize 设为 1024 KB,SDK 会最多输出总计 5 MB 的日志文件。如果你将 fileSize 设为小于 1024 KB,则设置不生效,单个日志文件最大仍为 1024 KB。
- level
- Agora SDK 的日志输出等级,详见 LOG_LEVEL。
Metadata
媒体附属信息。
export interface Metadata { uid: number; size: number; buffer: string; timeStampMs: number; }
属性
- uid
-
用户 ID。
- 对于接收者:发送该 Metadata 的远端用户的 ID。
- 对于发送者:请忽略。
- size
- 接收到的或发送的 Metadata 的缓存大小。
- buffer
- 接收到的或发送的 Metadata 的缓存地址。
- timeStampMs
- Metadata 的时间戳,单位为毫秒。
Plugin
用于配置和管理插件的接口。
export interface Plugin { id: string; enable: () => number; disable: () => number; setParameter: (param: string) => number; getParameter: (paramKey: string) => string; }
调用 registerPlugin 注册插件后,你可以通过 getPlugins 获取 Plugin 接口。
属性
- id
- 用于标识插件的 ID。
- enable
- 开启插件。
- disable
- 关闭插件。
- setParameter
- 设置插件参数。调用 getParameter 获取到 Value 值后,你可以调用本方法将包含 Key 和 Value 值的 JSON 字符串数据传递给 C++ 层。
- getParameter
- 获取插件参数。如果你想在使用插件时将 JSON 字符串数据传递给 C++ 层,你需要调用该方法和 setParameter获取并设置参数。
PluginInfo
插件信息。
export interface PluginInfo { pluginId: string; pluginPath: string; order: number; }
属性
- pluginId
- 用于标识插件的 ID。
- pluginPath
- 插件文件的绝对路径。
- order
- 插件的优先级。使用多个插件时,SDK 会根据优先级使用插件。取值为不小于 0 的整数。0 代表最高优先级。
Rect
屏幕共享区域。
export interface Rect { top: number; left: number; bottom: number; right: number; }
- 弃用:
- 该类已废弃,请使用 updateScreenCaptureRegion 方法更新屏幕共享区域。
属性
- top
- 共享区域顶部在纵轴上的坐标。
- left
- 共享区域左侧在横轴上的坐标。
- bottom
- 共享区域底部在纵轴上的坐标。
- right
- 共享区域右侧在横轴上的坐标。
Rectangle
待共享区域相对于整个屏幕或窗口的位置,如不填,则表示共享整个屏幕或窗口。
export interface Rectangle { x: number; y: number; width: number; height: number; }
属性
- x
- 左上角的横向偏移。
- y
- 左上角的纵向偏移。
- width
- 待共享区域的宽。
- height
- 待共享区域的高。
RemoteAudioStats
远端用户的音频统计数据。
export interface RemoteAudioStats { uid: number; quality: number; networkTransportDelay: number; jitterBufferDelay: number; audioLossRate: number; numChannels: number; receivedSampleRate: number; receivedBitrate: number; totalFrozenTime: number; frozenRate: number; totalActiveTime: number; publishDuration: number; qoeQuality: number; qualityChangedReason: number; mosValue: number; }
属性
- uid
- 远端用户的用户 ID。
- quality
- 远端用户发送的音频流质量,详见 QUALITY_TYPE。
- networkTransportDelay
- 音频发送端到接收端的网络延迟(毫秒)。
- jitterBufferDelay
-
音频接收端到网络抖动缓冲的网络延迟(毫秒)。注意: 当接收端为观众且 AUDIENCE_LATENCY_LEVEL_TYPE 为 1 时,该参数不生效。
- audioLossRate
- 统计周期内的远端音频流的丢帧率 (%)。
- numChannels
- 声道数。
- receivedSampleRate
- 统计周期内接收到的远端音频流的采样率。
- receivedBitrate
- 接收到的远端音频流在统计周期内的平均码率(Kbps)。
- totalFrozenTime
- 远端用户在加入频道后发生音频卡顿的累计时长(ms)。通话过程中,音频丢帧率达到 4% 即记为一次音频卡顿。
- frozenRate
- 音频卡顿的累计时长占音频总有效时长的百分比 (%)。音频有效时长是指远端用户加入频道后音频未被停止发送或禁用的时长。
- totalActiveTime
- 音频有效时长(毫秒),即远端用户加入频道后,既没有停止发送音频流,也没有禁用音频模块的通话时长。
- publishDuration
- 远端音频流的累计发布时长(毫秒)。
- qoeQuality
-
- 自从
- v3.3.0
接收远端音频时,本地用户的主观体验质量,详见 EXPERIENCE_QUALITY_TYPE。
- qualityChangedReason
-
接收远端音频时,本地用户主观体验质量较差的原因,详见 EXPERIENCE_POOR_REASON。
- mosValue
-
统计周期内,Agora 实时音频 MOS(平均主观意见分)评估方法对接收到的远端音频流的质量评分。返回值范围为 [0,500]。返回值除以 100 即可得到 MOS 分数,范围为 [0,5] 分,分数越高,音频质量越好。
Agora 实时音频 MOS 评分对应的主观音质感受如下:MOS分数 音质感受 大于 4 分 音频质量佳,清晰流畅。 3.5 - 4 分 音频质量较好,偶有音质损伤,但依然清晰。 3 - 3.5 分 音频质量一般,偶有卡顿,不是非常流畅,需要一点注意力才能听清。 2.5 - 3 分 音频质量较差,卡顿频繁,需要集中精力才能听清。 2 - 2.5 分 音频质量很差,偶有杂音,部分语义丢失,难以交流。 小于 2 分 音频质量非常差,杂音频现,大量语义丢失,完全无法交流。
RemoteVideoStats
远端视频流的统计信息。
export interface RemoteVideoStats { uid: number; delay: number; width: number; height: number; receivedBitrate: number; decoderOutputFrameRate: number; rendererOutputFrameRate: number; rxStreamType: REMOTE_VIDEO_STREAM_TYPE; totalFrozenTime: number; frozenRate: number; packetLossRate: number; totalActiveTime: number; publishDuration: number; }
属性
- uid
- 用户 ID,指定是哪个用户的视频流。
- delay
-
- 弃用:
- 在有音画同步机制的音视频场景中,你可以参考 RemoteAudioStats 里的 networkTransportDelay 和 jitterBufferDelay 成员的值,了解视频的延迟数据。
延时(毫秒)。
- width
- 视频流宽(像素)。
- height
- 视频流高(像素)。
- receivedBitrate
- (上次统计后)接收到的码率(Kbps)。
- decoderOutputFrameRate
- 远端视频解码器的输出帧率,单位为 fps。
- rendererOutputFrameRate
- 远端视频渲染器的输出帧率,单位为 fps。
- packetLossRate
- 远端视频在使用抗丢包技术之后的丢包率(%)。
- rxStreamType
- 视频流类型,大流或小流。详见 REMOTE_VIDEO_STREAM_TYPE。
- totalFrozenTime
- 远端用户在加入频道后发生视频卡顿的累计时长(ms)。通话过程中,视频帧率设置不低于 5 fps 时,连续渲染的两帧视频之间间隔超过 500 ms,则记为一次视频卡顿。
- frozenRate
- 远端用户在加入频道后发生视频卡顿的累计时长占视频总有效时长的百分比 (%)。视频有效时长是指远端用户加入频道后视频未被停止发送或禁用的时长。
- totalActiveTime
- 视频有效时长(毫秒),即远端用户/主播加入频道后,既没有停止发送视频流,也没有禁用视频模块的通话时长。
- publishDuration
- 远端视频流的累计发布时长(毫秒)。
RendererConfig
视频渲染配置选项。
export interface RendererConfig { user: User; view: Element | undefined; rendererOptions?: RendererOptions; channelId?: Channel; fps?: number;
属性
- user
- 视频所属的用户,详见 User。
- view
- 用于渲染视频的 Dom。传空代表销毁视频渲染。
- rendererOptions
- 视频的渲染选项。详见 RendererOptions。
- channelId
- 标识视频渲染所属的频道的 ID,详见 Channel。你只需要在多频道场景下对该参数设值。
- fps
- 视频渲染帧率 (fps)。最大值不能超过 30。
RendererOptions
视频渲染选项。
export interface RendererOptions { append: boolean; contentMode: CONTENT_MODE; mirror: boolean; }
属性
- append
- 当新视频也连接 Dom 时,是否使用原生 appendChild 方法向 Dom 添加子 Dom:
true
: 添加子 Dom。新视频和原视频可以同时呈现。false
: (默认) 不添加子 Dom。新视频将取代原视频。
- contentMode
- 视频内容显示模式。详见 CONTENT_MODE。
- mirror
- 渲染视频时,是否开启视频镜像:
true
: 开启镜像。false
: (默认) 不开启镜像。
RtcEngineContext
Agora SDK 初始化设置。
export interface RtcEngineContext { appId: string; areaCode?: AREA_CODE; logConfig?: LogConfig; }
属性
- appId
Agora 为 app 开发项目签发的 App ID。使用同一个 App ID 的用户才能进入同一个频道进行通话或直播。
一个 App ID 只能用于创建一个 AgoraRtcEngine。如果需要更换 App ID,必须先调用 release 销毁当前 IRtcEngine,再调用 initializeWithContext 重新创建 AgoraRtcEngine。
- areaCode
服务器的访问区域。该功能为高级设置,适用于有访问安全限制的场景。支持的区域详见 AREA_CODE。
指定访问区域后,Agora SDK 会连接指定区域内的 Agora 服务器。
- logConfig
Agora SDK 日志文件配置,详见 LogConfig。
默认情况下,SDK 会生成
agorasdk.log
、agorasdk_1.log
、agorasdk_2.log
、agorasdk_3.log
、agorasdk_4.log
这 5 个日志文件。每个日志文件的默认大小为 1024 KB,编码格式为 UTF-8。最新的日志永远写在
agorasdk.log
中。agorasdk.log
写满后,SDK 会从 1-4 中删除修改时间最早的一个文件,然后将agorasdk.log
重命名为该文件,并建立新的 agorasdk.log 写入最新的日志。
RtcImage
图像属性。
export interface RtcImage { x: number, y: number, width: number, height: number, url: string }
用于设置直播视频的水印和背景图片的属性。
属性
- url
-
直播视频上图片的 HTTP/HTTPS 地址。字符长度不得超过 1024 字节。
- x
- 图片在视频画面上的 x 坐标 (pixel),以输出视频画面的左上角为原点。
- y
- 图片在视频画面上的 y 坐标 (pixel),以输出视频画面的左上角为原点。
- width
- 图片在视频画面上的宽度 (pixel)。
- height
- 图片在视频画面上的高度 (pixel)。
RtcStats
通话相关的统计信息。
export interface RtcStats { duration: number; txBytes: number; rxBytes: number; txKBitRate: number; rxKBitRate: number; rxAudioKBitRate: number; txAudioKBitRate: number; rxVideoKBitRate: number; txVideoKBitRate: number; rxAudioKBytes: number; txAudioKBytes: number; rxVideoKBytes: number; txVideoKBytes: number; lastmileDelay: number; txPacketLossRate: number; rxPacketLossRate: number; userCount: number; cpuAppUsage: number; cpuTotalUsage: number; gatewayRtt: number; memoryAppUsageRatio: number; memoryTotalUsageRatio: number; memoryAppUsageInKbytes: number; }
属性
- duration
-
本地用户通话时长(秒),累计值。
- txBytes
- 发送字节数(bytes)。
- rxBytes
- 接收字节数(bytes)。
- txAudioBytes
- 发送音频字节数(bytes),累计值。
- txVideoBytes
- 发送视频字节数(bytes),累计值。
- rxAudioBytes
- 接收音频字节数(bytes),累计值。
- rxVideoBytes
- 接收视频字节数(bytes),累计值。
- txKBitRate
- 发送码率(Kbps)。
- rxKBitRate
- 接收码率(Kbps)。
- rxAudioKBitRate
- 音频接收码率 (Kbps)。
- txAudioKBitRate
- 音频包的发送码率 (Kbps)。
- rxVideoKBitRate
- 视频接收码率 (Kbps)。
- txVideoKBitRate
- 视频发送码率 (Kbps)。
- lastmileDelay
- 客户端-接入服务器延时 (毫秒)。
- txPacketLossRate
- 使用抗丢包技术前,客户端上行发送到服务器丢包率 (%)。
- rxPacketLossRate
- 使用抗丢包技术前,服务器下行发送到客户端丢包率 (%)。
- userCount
- 当前频道内的用户人数。
- 通信场景下,当前频道内的用户人数。
- 直播场景下,
- 如果本地用户为观众,为频道内的主播人数 + 1;
- 如果本地用户为主播,为频道内的主播人数。
- cpuAppUsage
- 当前 App 的 CPU 使用率 (%)。
- cpuTotalUsage
-
当前系统的 CPU 使用率 (%)。
在多核环境中,该成员指多核 CPU 的平均使用率。 计算方式为 100 - 任务管理中显示的系统空闲进程 CPU()。
- gatewayRtt
- 客户端到本地路由器的往返时延 (ms)。
- memoryAppUsageRatio
-
当前 App 的内存占比 (%)。
注意: 该值仅作参考。受系统限制可能无法获取。 - memoryTotalUsageRatio
-
当前系统的内存占比 (%)。
注意: 该值仅作参考。受系统限制可能无法获取。 - memoryAppUsageInKbytes
-
当前 App 的内存大小 (KB)。
注意: 该值仅作参考。受系统限制可能无法获取。
ScreenCaptureParameters
屏幕共享的参数配置。
export interface ScreenCaptureParameters { width: number; height: number; frameRate: number; bitrate: number; captureMouseCursor: boolean; windowFocus: boolean; excludeWindowList: Array<number>; excludeWindowCount: number; }
属性
- dimensions
编码共享视频的最大像素值。详见 VideoDimensions。默认值为 1920 × 1080,即 2073600 像素。该像素值为计费标准。
当共享的屏幕分辨率宽高比与该值设置不一致时,SDK 按如下策略进行编码。假设dimensions
设为 1920 × 1080:- 如果屏幕分辨率小于
dimensions
,如 1000 × 1000,SDK 直接按 1000 × 1000 进行编码。 - 如果屏幕分辨率大于
dimensions
,如 2000 × 1500,SDK 按屏幕分辨率的宽高比,即 4:3,取 dimensions 以内的最大分辨率进行编码,即 1440 × 1080。
- 如果屏幕分辨率小于
- frameRate
- 共享视频的帧率,单位为 fps;默认值为 5,建议不要超过 15。
- bitrate
- 共享视频的码率,单位为 Kbps;默认值为 0,表示 SDK 根据当前共享屏幕的分辨率计算出一个合理的值。
- captureMouseCursor
-
- 自从
- v2.4.1
是否采集鼠标用于屏幕共享:true
:(默认)采集鼠标。false
: 不采集鼠标。
- windowFocus
- 自从
- v3.1.0
调用 startScreenCaptureByWindow 方法共享窗口时,是否将该窗口前置:true
: 前置窗口。false
:(默认)不前置窗口。
- excludeWindowList
ScreenSymbol
屏幕共享的区域。
export type ScreenSymbol = number | Rectangle;
- number: macOS 上的 Display ID。
- Rectangle: Windows 上的 Screen Rect。
TranscodingUser
参与转码合流的每个主播的设置。
export interface TranscodingUser { uid: number; x: number; y: number; width: number; height: number; zOrder: number; alpha: number; audioChannel: number; }
属性
- uid
-
主播的用户 ID。
- x
-
主播视频画面在输出视频画面的 x 坐标 (pixel),以输出视频画面的左上角为原点。取值范围为[0,width],width 为 LiveTranscoding 中设置的
width
。 - y
- 主播视频画面在输出视频画面的 y 坐标 (pixel),以输出视频画面的左上角为原点。取值范围为[0,height],height 为 LiveTranscoding 中设置的
height
。 - width
- 主播视频画面的宽 (pixel)。
- height
-
主播视频画面的高 (pixel)。
- zOrder
-
主播视频画面的图层编号。取值范围为 [0,100]。
- 0:(默认)视频画面位于图层的最下层。
- 100: 视频画面位于图层的最上层。
注意:- 如果取值小于 0 或大于 100,会返回错误
ERR_INVALID_ARGUMENT
。 - 从 v2.3 开始,支持将 zOrder 设置为 0。
- alpha
-
主播视频画面的透明度。取值范围为 [0.0,1.0]。
- 0.0: 完全透明。
- 1.0:(默认)完全不透明。
- audioChannel
-
主播音频在输出音频中占用的声道。默认值为 0,取值范围为 [0,5]:
0
: (推荐)默认混音设置,最多支持双声道,与主播上行音频相关。1
: 主播音频在输出音频的 FL 声道。如果主播上行音频是多声道,Agora 服务器会先把多声道混音成单声道。2
: 主播音频在输出音频的 FC 声道。如果主播上行音频是多声道,Agora 服务器会先把多声道混音成单声道。3
: 主播音频在输出音频的 FR 声道。如果主播上行音频是多声道,Agora 服务器会先把多声道混音成单声道。4
: 主播音频在输出音频的 BL 声道。如果主播上行音频是多声道,Agora 服务器会先把多声道混音成单声道。5
: 主播音频在输出音频的 BR 声道。如果主播上行音频是多声道,Agora 服务器会先把多声道混音成单声道。0xFF
或取值大于5
: 该主播音频静音,Agora 服务器移除该主播的音频。
注意: 取值不为0
时,需要使用特殊的播放器。
User
视频相关用户信息。
export type User = "local" | "videoSource" | number | string ;
- "local":代表本地用户的视频渲染。
- "videoSource":代表 video source 对象的视频渲染。
- 整数:该数值和远端用户 UID 一致,代表远端用户的视频渲染。
- 字符串:该字符串和远端用户 User Account 一致,代表远端用户的视频渲染。
UserInfo
用户信息。
export interface UserInfo { uid: number; userAccount: string; }
- 自从
- v2.8.0
属性
- uid
- 用户 ID。
- userAccount
- 用户 User Account。
VideoDimensions
视频尺寸。
export interface VideoDimensions { width: number, height: number }
属性
- width
-
视频宽度,单位为像素。
- height
- 视频高度,单位为像素。
VideoEncoderConfiguration
视频编码器的配置。
export interface VideoEncoderConfiguration { dimensions: VideoDimensions; frameRate: FRAME_RATE; minFrameRate: number; bitrate: number; minBitrate: number; orientationMode: ORIENTATION_MODE; degradationPreference: DEGRADATION_PREFERENCE; mirrorMode: VIDEO_MIRROR_MODE_TYPE; }
属性
- dimensions
-
视频编码的分辨率(px),详见 VideoDimensions。该参数用于衡量编码质量,以长 × 宽表示,默认值为 640 × 360。用户可以自行设置分辨率。
- frameRate
-
视频编码的帧率(fps),详见 FRAME_RATE。默认值为 15。
- minFramerate
- 视频的最小帧率。默认值为 -1。
- bitrate
-
视频编码码率,单位为 Kbps。
你可以根据场景需要参照下表手动设置你想要的码率。若设置的视频码率超出合理范围,SDK 会自动按照合理区间处理码率。你也可以直接选择如下任意一种模式进行设置:
- STANDARD_BITRATE : (推荐) 标准码率模式。该模式下,视频在直播场景下的码率是通信场景的两倍。
- COMPATIBLE_BITRATE: 适配码率模式。该模式下,视频在通信和直播场景下的码率一致。直播时如果选择该模式,视频帧率可能会低于设置的值。
Agora 在通信和直播场景下采用不同的编码方式,以提升不同场景下的用户体验。通信场景保证流畅,而直播场景则更注重画面质量,因此直播场景对码率的需求大于通信场景。所以声网推荐将该参数设置为 STANDARD_BITRATE。你也可以直接将直播场景的码率值设为通信场景码率值的 2 倍。
分辨率 帧率(fps) 通信码率(Kbps) 直播码率(Kbps) 160 × 120 15 65 130 120 × 120 15 50 100 320 × 180 15 140 280 180 × 180 15 100 200 240 × 180 15 120 240 320 × 240 15 200 400 240 × 240 15 140 280 424 × 240 15 220 440 640 × 360 15 400 800 360 × 360 15 260 520 640 × 360 30 600 1200 360 × 360 30 400 800 480 × 360 15 320 640 480 × 360 30 490 980 640 × 480 15 500 1000 480 × 480 15 400 800 640 × 480 30 750 1500 480 × 480 30 600 1200 848 × 480 15 610 1220 848 × 480 30 930 1860 640 × 480 10 400 800 1280 × 720 15 1130 2260 1280 × 720 30 1710 3420 960 × 720 15 910 1820 960 × 720 30 1380 2760 1920 × 1080 15 2080 4160 1920 × 1080 30 3150 6300 1920 × 1080 60 4780 6500 - minBitrate
-
最低编码码率,单位为 Kbps。
SDK 会根据网络状况自动调整视频编码码率。将参数设为高于默认值可强制视频编码器输出高质量图片,但在网络状况不佳情况下可能导致网络丢包并影响视频播放的流畅度造成卡顿。因此如非对画质有特殊需求,声网建议不要修改该参数的值。
注意: 该参数仅适用于直播场景。 - orientationMode
- 视频编码的方向模式,详见 ORIENTATION_MODE。
- degradationPreference
- 带宽受限时,视频编码降级偏好。详见 DEGRADATION_PREFERENCE 。
- mirrorMode
-
- 自从
- v3.3.0
发送编码视频时是否开启镜像模式,只影响远端用户看到的视频画面。详见 VIDEO_MIRROR_MODE_TYPE。
注意: 默认关闭镜像模式。
WatermarkOptions
水印图片的设置。
export interface WatermarkOptions { visibleInPreview: boolean, positionInPortraitMode: Rectangle, positionInLandscapeMode: Rectangle }
属性
- visibleInPreview
-
水印图片在本地视频预览中是否可见:
true
:(默认) 水印图片在本地视频预览中可见;false
:水印图片在本地视频预览中不可见。
- positionInLandscapeMode
- positionInPortraitMode
WindowInfo
窗口信息。
export interface WindowInfo { windowId: number; name: string; ownerName: string; isOnScreen: boolean; width: number; height: number; originWidth: number; originHeight: number; image: Uint8Array; }
属性
- windowId
- 标识窗口的 Window ID。
- name
- 窗口名称。
- ownerName
- 窗口对应的应用进程名称。
- isOnScreen
- 窗口是否显示在屏幕上。
- width
- 窗口缩略图的宽度 (px)。
- height
- 窗口缩略图的高度 (px)。
- originWidth
- 窗口原始的宽度 (px)。
- originHeight
- 窗口原始的高度 (px)。
- image
- 窗口缩略图。详见 原生 Uint8Array。