类型定义
本页列出 Flutter API 所有的类型定义。
AreaCode
访问区域,即 SDK 连接的服务器所在的区域。
枚举值
- CN
- 中国大陆。
- NA
- 北美区域。
- EU
- 欧洲区域。
- AS
- 除中国以外的亚洲区域。
- JP
- 日本。
- IN
- 印度。
- GLOB
- 全球。
AudienceLatencyLevelType
直播频道中观众的延时级别。该枚举仅在用户角色设为 Audience 时才生效。
枚举值
- LowLatency
- 1: 低延时。
- UltraLowLatency
- 2:(默认)超低延时。
AudioFileInfoError
AudioCodecProfileType
推流输出音频的编解码规格,默认为 LC-AAC。
枚举值
- LCAAC
- 0: (默认)LC-AAC 规格。
- HEAAC
- 1: HE-AAC 规格。
- HEAACV2
- 2: HE-AAC v2 规格。
AudioEffectPreset
预设的音效选项。
为获取更好的人声效果,声网建议在使用以下预设音效前将 setAudioProfile 的 profile 参数设置为 MusicHighQuality 或 MusicHighQualityStereo:
- RoomAcousticsKTV
- RoomAcousticsVocalConcert
- RoomAcousticsStudio
- RoomAcousticsPhonograph
- RoomAcousticsSpacial
- RoomAcousticsEthereal
- VoiceChangerEffectUncle
- VoiceChangerEffectOldMan
- VoiceChangerEffectBoy
- VoiceChangerEffectSister
- VoiceChangerEffectGirl
- VoiceChangerEffectPigKing
- VoiceChangerEffectHulk
- PitchCorrection
枚举值
- AudioEffectOff
- 原声,即关闭人声音效。
- RoomAcousticsKTV
- KTV。
- RoomAcousticsVocalConcert
- 演唱会。
- RoomAcousticsStudio
- 录音棚。
- RoomAcousticsPhonograph
- 留声机。
- RoomAcousticsVirtualStereo
-
虚拟立体声,即 SDK 将单声道的音频渲染出双声道的音效。
注意: 使用该预设音效前,你需要将 setAudioProfile 的 profile 参数设置为 MusicHighQuality 或 MusicHighQualityStereo,否则该预设音效的设置无效。 - RoomAcousticsSpacial
- 空旷。
- RoomAcousticsEthereal
- 空灵。
- RoomAcoustics3DVoice
-
3D 人声,即 SDK 将音频渲染出在用户周围环绕的效果。环绕周期默认为 10 秒。设置该音效后,你还可以调用 setAudioEffectParameters 修改环绕周期。
注意:- 使用该预设音效前,你需要将 setAudioProfile 的 profile 参数设置为 MusicStandardStereo 或 MusicHighQualityStereo,否则该预设音效的设置无效。
- 启用 3D 人声后,用户需要使用支持双声道的音频播放设备才能听到预期效果。
- VoiceChangerEffectUncle
-
大叔。
注意: 建议用于处理男声,否则无法达到预期效果。 - VoiceChangerEffectOldMan
-
老年男性。
注意: 建议用于处理男声,否则无法达到预期效果。 - VoiceChangerEffectBoy
-
男孩。
注意: 建议用于处理男声,否则无法达到预期效果。 - VoiceChangerEffectSister
-
少女。
注意: 建议用于处理女声,否则无法达到预期效果。 - VoiceChangerEffectGirl
-
女孩。
注意: 建议用于处理女声,否则无法达到预期效果。 - VoiceChangerEffectPigKing
- 猪八戒。
- VoiceChangerEffectHulk
- 绿巨人。
- StyleTransformationRnB
-
R&B。
注意: 使用该预设音效前,你需要将 setAudioProfile 的 profile 参数设置为 MusicHighQuality 或 MusicHighQualityStereo,否则该预设音效的设置无效。 - StyleTransformationPopular
-
流行。
注意: 使用该预设音效前,你需要将 setAudioProfile 的 profile 参数设置为 MusicHighQuality 或 MusicHighQualityStereo,否则该预设音效的设置无效。 - PitchCorrection
- 电音,即 SDK 以主音音高为 C 的自然大调为基础修正音频的实际音高。设置该音效后,你还可以调用 setAudioEffectParameters 调整修音的基础调式和主音音高。
AudioEqualizationBandFrequency
语音音效均衡波段的中心频率。
枚举值
- Band31
- 0: 31 Hz
- Band62
- 1: 62 Hz
- Band125
- 2: 125 Hz
- Band250
- 3: 250 Hz
- Band500
- 4: 500 Hz
- Band1K
- 5: 1 kHz
- Band2K
- 6: 2 kHz
- Band4K
- 7: 4 kHz
- Band8K
- 8: 8 kHz
- Band16K
- 9: 16 kHz
AudioMixingDualMonoMode
声道模式。
- 自从
- v3.5.1
枚举值
- Auto
- 0: 原始模式。
- L
- 1: 左声道模式。该模式用左声道的音频替换右声道的音频,即用户只能听到左声道的音频。
- R
- 2: 右声道模式。该模式用右声道的音频替换左声道的音频,即用户只能听到右声道的音频。
- MIX
- 3: 混合模式。该模式将左右声道的数据叠加,即用户能同时听到左声道和右声道的音频。
AudioMixingErrorType
播放音乐文件时可能出现的错误。
- 弃用:
- 从 v3.4.0 起废弃。
枚举值
- CanNotOpen
- 音乐文件打开出错。
- TooFrequentCall
- 音乐文件打开太频繁。
- InterruptedEOF
- 音乐文件播放中断。
- OK
- 音乐文件正常播放。
AudioMixingReason
音乐文件播放状态改变的原因。在 audioMixingStateChanged 回调中报告。
枚举值
- CanNotOpen
- 701: 音乐文件打开出错。例如,本地音乐文件不存在、文件格式不支持或无法访问在线音乐文件 URL。
- TooFrequentCall
- 702: 音乐文件打开太频繁。如需多次调用 startAudioMixing,请确保调用间隔大于 500 ms。
- InterruptedEOF
- 703: 音乐文件播放中断。
- StartedByUser
- 720: 成功调用 startAudioMixing 播放音乐文件。
- OneLoopCompleted
- 721: 音乐文件完成一次循环播放。
- StartNewLoop
- 722: 音乐文件开始新的一次循环播放。
- AllLoopsCompleted
- 723: 音乐文件完成所有循环播放。
- StoppedByUser
- 724: 成功调用 stopAudioMixing 停止播放音乐文件。
- PausedByUser
- 725: 成功调用 pauseAudioMixing 暂停播放音乐文件。
- ResumedByUser
- 726: 成功调用 resumeAudioMixing 恢复播放音乐文件。
AudioMixingStateCode
音乐文件播放状态。
枚举值
- Playing
-
710: 音乐文件正常播放。
该状态可能由于以下原因导致:- StartedByUser(710)
- OneLoopCompleted(720)
- StartNewLoop(722)
- ResumedByUser(726)
- Paused
-
711: 音乐文件暂停播放。
该状态由 PausedByUser(725) 原因导致。
- Stopped
-
713: 音乐文件停止播放。
该状态可能由以下原因导致:- AllLoopsCompleted(723)
- StoppedByUser(724)
- Failed
-
714: 音乐文件播放出错。
该状态可能由以下原因导致:- CanNotOpen(701)
- TooFrequentCall(702)
- InterruptedEOF(703)
AudioProfile
音频编码属性。
枚举值
- Default
-
0: 默认值。
- 直播场景下:48 kHz 采样率,音乐编码,单声道,编码码率最大值为 64 Kbps。
- 通信场景下:
- SpeechStandard
- 1: 指定 32 kHz 采样率,语音编码,单声道,编码码率最大值为 18 Kbps。
- MusicStandard
- 2: 指定 48 kHz 采样率,音乐编码,单声道,编码码率最大值为 64 Kbps。
- MusicStandardStereo
- 3: 指定 48 kHz 采样率,音乐编码,双声道,编码码率最大值为 80 Kbps。
- MusicHighQuality
- 4: 指定 48 kHz 采样率,音乐编码,单声道,编码码率最大值为 96 Kbps。
- MusicHighQualityStereo
- 5: 指定 48 kHz 采样率,音乐编码,双声道,编码码率最大值为 128 Kbps。
- 枚举值边界。
AudioRecordingPosition
录音内容。在 startAudioRecordingWithConfig 中设置。
- 自从
- v3.4.0
枚举值
- PositionMixedRecordingAndPlayback
- 0:(默认)录制本地和所有远端用户混音后的音频。
- PositionRecording
- 1: 仅录制本地用户的音频。
- PositionMixedPlayback
- 2: 仅录制所有远端用户的音频。
AudioRecordingQuality
录音音质。
枚举值
- Low
- 0: 低音质。采样率为 32 kHz,录制 10 分钟的文件大小为 1.2 M 左右。
- Medium
- 1: 中音质。采样率为 32 kHz,录制 10 分钟的文件大小为 2 M 左右。
- High
- 2: 高音质。采样率为 32 kHz,录制 10 分钟的文件大小为 3.75 M 左右。
- UltraHigh
- 3: 超高音质。采样率为 32 KHz,录制 10 分钟的文件大小约为 7.5 M 左右。
AudioReverbPreset
预设的语音混响效果。
- 弃用:
- 自 v3.2.0 废弃。
枚举值
- Off
- 原声,即关闭本地语音混响。
- FX_KTV
- KTV(增强版)。
- FX_VOCAL_CONCERT
- 演唱会(增强版)。
- FX_UNCLE
- 大叔。
- FX_SISTER
- 小姐姐。
- FX_STUDIO
- 录音棚(增强版)。
- FX_POPULAR
- 流行(增强版)。
- FX_RNB
- R&B(增强版)。
- FX_PHONOGRAPH
- 留声机。
- Popular
- 流行。
- RnB
- R&B。
- Rock
- 摇滚。
- HipHop
- 嘻哈。
- VocalConcert
- 演唱会。
- KTV
- KTV。
- Studio
- 录音棚。
- VIRTUAL_STEREO
- 虚拟立体声。虚拟立体声是指将单声道的音轨渲染出立体声的效果。
- AUDIO_ELECTRONIC_VOICE
- 电音,即 SDK 以主音音高为 C 的自然大调为基础修正音频的实际音高。
- AUDIO_THREEDIM_VOICE
- 3D 人声,即 SDK 将音频渲染出在用户周围环绕的效果。
AudioReverbType
音频混响类型。
枚举值
- DryLevel
- 0: 原始声音强度,即所谓的 dry signal,取值范围 [-20,10],单位为 dB。
- WetLevel
- 1: 早期反射信号强度,即所谓的 wet signal,取值范围 [-20,10],单位为 dB。
- RoomSize
- 2: 所需混响效果的房间尺寸,一般房间越大,混响越强,取值范围 [0,100],单位为 dB。
- WetDelay
- 3: Wet signal 的初始延迟长度,取值范围 [0,200],单位为毫秒。
- Strength
- 4: 混响持续的强度,取值范围为 [0,100]。
AudioOutputRouting
语音路由的类型。
枚举值
- Default
- -1: 默认的语音路由。
- Headset
- 0: 耳机。
- Earpiece
- 1: 听筒。
- HeadsetNoMic
- 2: 不带麦的耳机。
- Speakerphone
- 3: 手机的扬声器。
- Loudspeaker
- 4: 外接的扬声器。
- HeadsetBluetooth
- 5: 蓝牙耳机。
- USB
- 6: USB 外围设备(仅适用于 macOS)。
- HDMI
- 7: HDMI 外围设备(仅适用于 macOS)。
- DisplayPort
- 8: DisplayPort 外围设备(仅适用于 macOS)。
- AirPlay
- 9: Apple AirPlay(仅适用于 macOS)。
AudioScenario
设置音频应用场景。
枚举值
- Default
- 0: 默认的音频应用场景。
- ChatRoomEntertainment
- 1: 娱乐场景,适用于用户需要频繁上下麦的场景。
- Education
- 2: 教育场景,适用于需要高流畅度和稳定性的场景。
- GameStreaming
- 3: 高音质语聊房场景,适用于音乐为主的场景。
- ShowRoom
- 4: 秀场场景,适用于需要高音质的单主播场景。
- ChatRoomGaming
- 5: 游戏开黑场景,适用于只有人声的场景。
- IOT
- 6: IoT(物联网)场景,适用于使用低功耗 IoT 设备的场景。
- MEETING
- 8: 会议场景,适用于人声为主的多人会议。
AudioSampleRateType
推流输出音频的采样率。
枚举值
- Type32000
- 32000: 32 kHz
- Type44100
- 44100: 44.1 kHz
- Type48000
- 48000: (默认)48 kHz
AudioSessionOperationRestriction
SDK 对 Audio Session 的控制权限。
枚举值
- None
- 没有限制,SDK 可以完全控制 Audio Session 操作。
- SetCategory
- SDK 不能更改 Audio Session 的 category。
- ConfigureSession
- SDK 不能更改 Audio Session 的 category,mode,categoryOptions。
- DeactivateSession
- 离开某个频道时,SDK 会保持 Audio Session 处于活动状态。
- All
- 限制 SDK 对 Audio Session 进行任何操作,SDK 将不能再对 Audio Session 进行任何配置。
BACKGROUND_SOURCE_TYPE
自定义的背景图类型。
枚举值
- BACKGROUND_COLOR
- 1:(默认)背景图为纯色。
- BACKGROUND_IMG
- 背景图为 PNG、JPG 格式的图片。
- BACKGROUND_BLUR
- 将虚化处理后的背景作为背景图。
VirtualBackgroundBlurDegree
自定义背景图的虚化程度。
枚举值
- Low
- 1: 自定义背景图的虚化程度为低。用户差不多能看清背景。
- Medium
- 自定义背景图的虚化程度为中。用户较难看清背景。
- High
- (默认)自定义背景图的虚化程度为高。用户很难看清背景。
CameraDirection
摄像头方向。
枚举值
- Rear
- 后置摄像头。
- Front
- 前置摄像头。
CaptureBrightnessLevelType
本地采集的画质亮度级别。
- 自从
- v3.3.0
枚举值
- Invalid
- -1: SDK 未检测出本地采集的画质亮度级别。请等待几秒,通过下一次回调的 captureBrightnessLevel 获取亮度级别。
- Normal
- 0: 本地采集的画质亮度正常。
- Bright
- 1: 本地采集的画质亮度偏亮。
- Dark
- 2: 本地采集的画质亮度偏暗。
CameraCaptureOutputPreference
摄像头采集偏好。
枚举值
- Auto
- 0:(默认)自动调整采集参数。SDK 根据实际的采集设备性能及网络情况,选择合适的摄像头输出参数,在设备性能及视频预览质量之间,维持平衡。
- Performance
- 1: 优先保证设备性能。SDK 根据用户在 setVideoEncoderConfiguration 中设置编码器的分辨率和帧率,选择最接近的摄像头输出参数,从而保证设备性能。在这种情况下,预览质量接近于编码器的输出质量。
- Preview
- 2: 优先保证视频预览质量。SDK 选择较高的摄像头输出参数,从而提高预览视频的质量。在这种情况下,会消耗更多的 CPU 及内存做视频前处理。
- Manual
-
- 自从
- v3.3.0
3: 允许用户设置本地摄像头采集的视频宽高。
ChannelMediaRelayError
跨频道媒体流转发出错的错误码。
枚举值
- None
- 0: 一切正常。
- ServerErrorResponse
- 1: 服务器回应出错。
- ServerNoResponse
-
2: 服务器无回应。
你可以调用 leaveChannel 方法离开频道。
该错误也可能是由于当前的 App ID 未开启连麦鉴权导致的。你可以https://agora-ticket.agora.io申请开通连麦鉴权服务。
- NoResourceAvailable
- 3: SDK 无法获取服务,可能是因为服务器资源有限导致。
- FailedJoinSourceChannel
- 4: 发起跨频道转发媒体流请求失败。
- FailedJoinDestinationChannel
- 5: 接受跨频道转发媒体流请求失败。
- FailedPacketReceivedFromSource
- 6: 服务器接收跨频道转发媒体流失败。
- FailedPacketSentToDestination
- 7: 服务器发送跨频道转发媒体流失败。
- ServerConnectionLost
- 8: SDK 因网络质量不佳与服务器断开。你可以调用 leaveChannel 方法离开当前频道。
- InternalError
- 9: 服务器内部出错。
- SourceTokenExpired
- 10: 源频道的 Token 已过期。
- DestinationTokenExpired
- 11: 目标频道的 Token 已过期。
ChannelMediaRelayEvent
跨频道媒体流转发事件码。
枚举值
- Disconnect
- 0: 网络中断导致用户与服务器连接断开。
- Connected
- 1: 用户与服务器建立连接。
- JoinedSourceChannel
- 2: 用户已加入源频道。
- JoinedDestinationChannel
- 3: 用户已加入目标频道。
- SentToDestinationChannel
- 4: SDK 开始向目标频道发送数据包。
- ReceivedVideoPacketFromSource
- 5: 服务器收到了频道发送的视频流。
- ReceivedAudioPacketFromSource
- 6: 服务器收到了频道发送的音频流。
- UpdateDestinationChannel
- 7: 目标频道已更新。
- UpdateDestinationChannelRefused
- 8: 内部原因导致目标频道更新失败。
- UpdateDestinationChannelNotChange
- 9: 目标频道未发生改变,即目标频道更新失败。
- UpdateDestinationChannelIsNil
- 10: 目标频道名为
null
。 - VideoProfileUpdate
- 11: 视频属性已发送至服务器。
ChannelMediaRelayState
跨频道媒体流转发状态码。
枚举值
- Idle
- 0: 初始状态。在成功调用 stopChannelMediaRelay 停止跨频道媒体流转发后, channelMediaRelayStateChanged 会回调该状态。
- Connecting
- 1: SDK 尝试跨频道。
- Running
- 2: 源频道主播成功加入目标频道。
- Failure
- 3: 发生异常,详见 channelMediaRelayStateChanged 的 code 参数提示的错误信息。
ChannelProfile
频道使用场景。
枚举值
- Communication
- 0: (默认)通信场景。该场景下,频道内所有用户都可以发布和接收音、视频流。适用于语音通话、视频群聊等应用场景。
- LiveBroadcasting
- 1: 直播场景。该场景有主播和观众两种用户角色,可以通过 setClientRole 设置。主播可以发布和接收音视频流,观众直接接收流。适用于语聊房、视频直播、互动大班课等应用场景。
- Game
- 2: 游戏语音场景。声网不推荐使用该场景。
ClientRole
直播场景里的用户角色。
枚举值
- Broadcaster
- 1: 主播。主播可以发流也可以收流。
- Audience
- 2:(默认)观众。观众只能收流不能发流。
CloudProxyType
云代理类型。
枚举值
- None
- 0:自动模式。在该模式下,SDK 优先连接 SD-RTN™,如果连接失败,自动切换到 TLS 443。自 v3.6.2 起,SDK 默认开启该模式。
- UDP
- 1:UDP 协议的云代理,即 Force UDP 云代理模式。在该模式下,SDK 始终通过 UDP 协议传输数据。
- TCP
- 2:TCP(加密)协议的云代理,即 Force TCP 云代理模式。在该模式下,SDK 始终通过 TLS 443 传输数据。
ConnectionChangedReason
网络连接状态发生变化的原因。
枚举值
- Connecting
- 0: 建立网络连接中。
- JoinSuccess
- 1: 成功加入频道。
- Interrupted
- 2: 网络连接中断。
- BannedByServer
- 3: 网络连接被服务器禁止。服务端踢人场景时会报这个错。
- JoinFailed
- 4: 加入频道失败。SDK 在尝试加入频道 20 分钟后还是没能加入频道,会返回该状态,并停止尝试重连。
- LeaveChannel
- 5: 离开频道。
- InvalidAppId
- 6: 不是有效的 APP ID。请更换有效的 APP ID 重新加入频道。
- InvalidChannelName
- 7: 不是有效的频道名。请更换有效的频道名重新加入频道。
- InvalidToken
-
8: 生成的 Token 无效。一般有以下原因:
- 在控制台上启用了 App Certificate,但加入频道未使用 Token。当启用了 App Certificate,必须使用 Token。
- 在调用 joinChannel 加入频道时指定的用户 ID 与生成 Token 时传入的用户 ID 不一致。
- TokenExpired
- 9: 当前使用的 Token 过期,不再有效,需要重新在你的服务端申请生成 Token。
- RejectedByServer
-
10: 此用户被服务器禁止。一般有以下原因:
- 用户已进入频道,再次调用加入频道的 API,例如 joinChannel,会返回此状态。停止调用该方法即可。
- 用户在进行通话测试时尝试加入频道。等待通话测试结束后再加入频道即可。
- SettingProxyServer
- 11: 由于设置了代理服务器,SDK 尝试重连。
- RenewToken
- 12: 更新 Token 引起网络连接状态改变。
- ClientIpAddressChanged
- 13: 客户端 IP 地址变更,可能是由于网络类型,或网络运营商的 IP 或端口发生改变引起。
- KeepAliveTimeout
- 14: SDK 和服务器连接保活超时,进入自动重连状态。
- SameUidLogin
- 19:使用相同的 UID 从不同的设备加入同一频道。
- TooManyBroadcasters
-
20:频道内主播人数已达上限。
注意: 该枚举仅在开启 128 人功能后报告。主播人数的上限根据开启 128 人功能时实际配置的人数而定。
ConnectionStateType
网络连接状态。
枚举值
- Disconnected
-
1: 网络连接断开。该状态表示 SDK 处于:
- 调用 joinChannel 加入频道前的初始化阶段。
- 或调用 leaveChannel 后的离开频道阶段。
- Connecting
-
2: 建立网络连接中。该状态表示 SDK 在调用 joinChannel 后正在与指定的频道建立连接。
- 如果成功加入频道,app 会收到 connectionStateChanged 回调,通知当前网络状态变成 Connected。
- 建立连接后,SDK 还会初始化媒体,一切就绪后会回调 joinChannelSuccess。
- Connected
- 3: 网络已连接。该状态表示用户已经加入频道,可以在频道内发布或订阅媒体流。如果因网络断开或切换而导致 SDK 与频道的连接中断,SDK 会自动重连,此时 app 会收到 connectionStateChanged 回调,通知当前网络状态变成 Reconnecting。
- Reconnecting
-
4: 重新建立网络连接中。该状态表示 SDK 之前曾加入过频道,但因网络等原因连接中断了,此时 SDK 会自动尝试重新接入频道。
- 如果 SDK 无法在 10 秒内重新加入频道,则 connectionLost 会被触发,SDK 会一直保持在 Reconnecting 的状态,并不断尝试重新加入频道。
- 如果 SDK 在断开连接后,20 分钟内还是没能重新加入频道,则应用程序会收到 connectionStateChanged 回调,通知 app 的网络状态进入 Failed,SDK 停止尝试重连。
- Failed
-
5: 网络连接失败。该状态表示 SDK 已不再尝试重新加入频道,需要调用 leaveChannel 离开频道。
- 如果用户还想重新加入频道,则需要再次调用 joinChannel。
- 如果 SDK 因服务器端使用 RESTful API 禁止加入频道,则 app 会收到 connectionStateChanged。
DegradationPreference
带宽受限时的视频编码降级偏好。
枚举值
- MaintainQuality
-
0:(默认)带宽受限时,视频编码时优先降低视频帧率,维持视频质量不变。该降级偏好适用于画质优先的场景。
注意: 通信(COMMUNICATION)场景下,本地发送的视频分辨率可能改变,远端用户需能处理这种情况, 详见 videoSizeChanged。 - MaintainFramerate
- 1:带宽受限时,视频编码时优先降低视频质量,维持视频帧率不变。该降级偏好适用于流畅性优先且允许画质降低的场景。
- MaintainBalanced
-
- 自从
- v3.4.0
2:带宽受限时,视频编码时同时降低视频帧率和视频质量。MaintainBalanced 的降幅比 MaintainQuality 和 MaintainFramerate 降幅更低, 适用于流畅性和画质均有限的场景。
注意: 本地发送的视频分辨率可能改变,远端用户需能处理这种情况,详见 videoSizeChanged。 - 3: 带宽受限时,视频编码时优先降低视频帧率。
EchoTestConfiguration
音视频通话回路测试的配置。
class EchoTestConfiguration { @JsonKey(includeIfNull: false) bool? enableAudio; @JsonKey(includeIfNull: false) bool? enableVideo; @JsonKey(includeIfNull: false) String? token; @JsonKey(includeIfNull: false) String? channelId; EchoTestConfiguration({ this.enableAudio, this.enableVideo, this.token, this.channelId, }); factory EchoTestConfiguration.fromJson(Map<String, dynamic> json) => _$EchoTestConfigurationFromJson(json); Map<String, dynamic> toJson() => _$EchoTestConfigurationToJson(this); }
属性
- view
- 用于渲染本地用户视频的视图。该参数仅适用于测试视频设备的场景,即该结构体中 enableVideo 为 true。
- enableAudio
- 是否开启音频设备:
- true: (默认) 开启音频设备。如需测试音频设备,请设为 true。
- false: 关闭音频设备。
- enableVideo
- 是否开启视频设备:
- true: (默认) 开启音频设备。如需测试视频设备,请设为 true。
- false: 关闭视频设备。
- token
- 用于保证音视频通话回路测试安全性的 Token。如果你在声网控制台未启用 App 证书,则不需要向该参数传值;
如果你在声网控制台已启用 App 证书,则必须向该参数传入 Token,且在你生成 Token 时使用的
uid
必须为 0xFFFFFFFF, 使用的频道名必须为标识每个音视频通话回路测试的频道名。服务端生成 Token 的方式请参考使用 Token 鉴权。 - channelId
- 标识每个音视频通话回路测试的频道名。为保证回路测试功能正常,同一个项目(App ID) 的各终端用户在不同设备上做音视频通话回路测试时,传入的标识每个回路测试的频道名不能相同。
EncryptionMode
内置加密模式。
声网推荐使用 AES128GCM2 或 AES256GCM2 加密模式。这两种模式支持使用盐,安全性更高。
枚举值
- AES128XTS
- 1:(默认)128 位 AES 加密,XTS 模式。
- AES128ECB
- 2: 128 位 AES 加密,ECB 模式。
- AES256XTS
- 3: 256 位 AES 加密,XTS 模式。
- SM4128ECB
- 4: 128 位 SM4 加密,ECB 模式。
- AES128GCM
- 5: 128 位 AES 加密,GCM 模式。
- AES256GCM
- 6: 256 位 AES 加密,GCM 模式。
- AES128GCM2
- 7: 128 位 AES 加密,GCM 模式。该加密模式需要设置盐(
encryptionKdfSalt
)。 - AES256GCM2
- 8: 256 位 AES 加密,GCM 模式。该加密模式需要设置盐(
encryptionKdfSalt
)。
ErrScreenCapture
屏幕共享错误类型。
枚举值
- ErrScreenCapturePermissionDenied
- 16:用户拒绝向应用授予屏幕采集权限。
- ErrScreenCaptureSystemNotSupported
- 2: 受系统限制,Android 5(API 级别 21)以下无法采集屏幕。当你在 Android 5 以下调用 startScreenCaptureMobile 时,SDK 会报告该错误码。
- ErrScreenCaptureSystemAudioNotSupported
- 3: 受系统限制,Android 10(API 级别 29)以下无法采集系统音频。 当你在 Android 5(API 级别 21)以上且 Android 10(API 级别 29)以下调用 startScreenCaptureMobile 并设置
captureAudio
为true
时,SDK 会报告该错误码。
ExcludeWindowError
屏幕共享时,屏蔽窗口的错误码。
枚举值
- Fail
- -1: 屏幕共享时,屏蔽窗口失败。用户的显卡不支持窗口屏蔽功能。
- None
- 0: 预留参数。
ExperiencePoorReason
接收远端音频时,本地用户主观体验质量较差的原因。
- 自从
- v3.3.0
枚举值
- None
- 0: 无原因,说明主观体验质量较好。
- RemoteNetworkQualityPoor
- 1: 远端用户的网络较差。
- LocalNetworkQualityPoor
- 2: 本地用户的网络较差。
- WirelessSignalPoor
- 4: 本地用户的 Wi-FI 或者移动数据网络信号弱。
- WifiBluetoothCoexist
- 8: 本地用户同时开启 Wi-Fi 和蓝牙,二者信号互相干扰,导致音频传输质量下降。
ExperienceQualityType
接收远端音频时,本地用户的主观体验质量。
- 自从
- v3.3.0
枚举值
- Good
- 0: 主观体验质量较好。
- Bad
- 1: 主观体验质量较差。
VideoFrameRate
视频帧率。
枚举值
- Fps1
- 1: 1 fps
- Fps7
- 7: 7 fps
- Fps10
- 10: 10 fps
- Fps15
- 15: 15 fps
- Fps24
- 24: 24 fps
- Fps30
- 30: 30 fps
- Fps60
-
60: 60 fps
注意: 仅适用于 Windows 和 macOS 平台。
LastmileProbeResultState
Last mile 质量探测结果的状态。
枚举值
- Complete
- 1: 表示本次 last mile 质量探测的结果是完整的。
- IncompleteNoBwe
- 2: 表示本次 last mile 质量探测未进行带宽预测,因此结果不完整。一个可能的原因是测试资源暂时受限。
- Unavailable
- 3: 未进行 last mile 质量探测。一个可能的原因是网络连接中断。
LighteningContrastLevel
亮度明暗对比度。
枚举值
- Low
- 低对比度。
- Normal
- 正常对比度。
- High
- 高对比度。
AudioLocalError
本地音频出错原因。
枚举值
- Ok
- 0: 本地音频状态正常。
- Failure
- 1: 本地音频出错原因不明确。
- DeviceNoPermission
- 2: 没有权限启动本地音频采集设备。
- DeviceBusy
- 3: 本地音频采集设备已经在使用中。
- RecordFailure
- 4: 本地音频采集失败,建议你检查采集设备是否正常工作。
- EncodeFailure
- 5: 本地音频编码失败。
- NoRecordingDevice
- 6: 无本地音频采集设备。请检查麦克风是否与设备连接正常,检查麦克风是否正常工作。
- NoPlayoutDevice
- 7: 无本地音频播放设备。请检查扬声器是否与设备连接正常,检查扬声器是否正常工作。
- Interrupted
- 8: 本地音频采集被系统来电中断。如需进行音频采集,请用户挂断电话。
- RecordInvalidId
- 9: 本地音频采集设备的 ID 无效。请检查音频采集设备 ID。
- PlayoutInvalidId
- 10: 本地音频播放设备的 ID 无效。请检查音频播放设备 ID。
AudioLocalState
本地音频状态。
枚举值
- Stopped
- 0: 本地音频默认初始状态。
- Recording
- 1: 本地音频采集设备启动成功。
- Encoding
- 2: 本地音频首帧编码成功。
- Failed
- 3: 本地音频启动失败。
LocalVideoStreamError
本地视频出错原因。
枚举值
- OK
- 0: 本地视频状态正常。
- Failure
- 1: 出错原因不明确。
- DeviceNoPermission
- 2: 没有权限启动本地视频采集设备。
- DeviceBusy
- 3: 本地视频采集设备正在使用中。
- CaptureFailure
- 4: 本地视频采集失败,建议检查采集设备是否正常工作。
- EncodeFailure
- 5: 本地视频编码失败。
- CaptureInBackground
- 6: 应用处于后台。
- CaptureMultipleForegroundApps
- 7: 应用窗口处于侧拉、分屏、画中画模式。
- DeviceNotFound
-
- 自从
- v3.4.0
8: 找不到本地视频采集设备。
- LocalVideoStreamErrorCaptureDeviceDisconnected
- 9:(仅支持 macOS)当前正在使用的外部摄像头已经断开连接(例如,被拔出)。
- LocalVideoStreamErrorDeviceInvalidId
- (仅 macOS 和 Windows)10: SDK 无法在视频设备列表中找到该视频设备。请检查视频设备 ID 是否有效。
- ScreenCaptureWindowMinmized
- 11: 调用 startScreenCaptureByWindowId 方法共享窗口时,共享窗口处于最小化的状态。
- ScreenCaptureWindowClosed
-
- 自从
- v3.2.0
12: 该错误码表示通过窗口 ID 共享的窗口已关闭,或通过窗口 ID 共享的全屏窗口已退出全屏。 退出全屏模式后,远端用户将无法看到共享的窗口。为避免远端用户看到黑屏,声网建议你立即结束本次共享。
报告该错误码的常见场景:- 本地用户关闭共享的窗口时,SDK 会报告该错误码。
- 本地用户先放映幻灯片,然后共享放映中的幻灯片。结束放映时,SDK 会报告该错误码。
- 本地用户先全屏观看网页视频或网页文档,然后共享网页视频或网页文档。结束全屏时,SDK 会报告该错误码。
- LocalVideoStreamErrorScreenCaptureWindowOccluded
- (仅 Windows)13: 待共享的窗口被其他窗口遮挡住,被遮挡住的部分在共享时会被 SDK 涂黑。
- LocalVideoStreamErrorExtensionCaptureStarted
- 13:(仅适用于 iOS)屏幕共享 Extension 进程开启。
- LocalVideoStreamErrorExtensionCaptureStoped
- 14:(仅适用于 iOS)屏幕共享 Extension 进程结束。
- LocalVideoStreamErrorExtensionCaptureDisconnected
- 15:(仅适用于 iOS)屏幕共享 Extension 进程异常退出。
- LocalVideoStreamErrorScreenCaptureWindowNotSupported
- 20: SDK 不支持共享该类型的窗口。
LocalVideoStreamState
本地视频状态。
枚举值
- Stopped
- 0: 本地视频默认初始状态。
- Capturing
- 1: 本地视频采集设备启动成功。
- Encoding
- 2: 本地视频首帧编码成功。
- Failed
- 3: 本地视频启动失败。
LogFilter
日志过滤等级。
枚举值
- Off
- 0: 不输出日志信息。
- Debug
- 0x080f: 输出所有 API 日志信息。 如果你想获取最完整的日志,可以将日志级别设为该等级。
- Info
- 0x000f: 输出 CRITICAL、ERROR、WARNING 和 INFO 级别的日志信息。 我们推荐你将日志级别设为该等级。
- Warning
- 0x000e: 输出 CRITICAL、ERROR 和 WARNING 级别的日志信息。
- Error
- 0x000c: 输出 CRITICAL 和 ERROR 级别的日志信息。
- Critical
- 0x0008: 输出 CRITICAL 级别的日志信息。
LogLevel
日志输出等级。
- 自从
- v3.3.0
枚举值
- None
- 0: 不输出任何日志。
- Info
- 0x0001:(默认)输出
FATAL
、ERROR
、WARN
、INFO
级别的日志。我们推荐你将日志级别设为该等级。 - Warn
- 0x0002: 仅输出
FATAL
、ERROR
、WARN
级别的日志。 - Error
- 0x0004: 仅输出
FATAL
、ERROR
级别的日志。 - Fatal
- 0x0008: 仅输出
FATAL
级别的日志。
LowLightEnhanceMode
暗光增强模式。
枚举值
- Auto
- 0:(默认)自动模式。SDK 会根据环境光亮度自动开启或关闭暗光增强功能,以适时补光和防止过曝。
- Manual
- 手动模式。用户需手动开启或关闭暗光增强功能。
LowLightEnhanceLevel
暗光增强等级。
枚举值
- HighQuality
- 0:(默认)优先画质的暗光增强,会处理视频图像的亮度、细节、噪声,消耗的性能适中,处理速度适中,综合画质最优。
- Fast
- 优先性能的暗光增强,会处理视频图像的亮度、细节,消耗的性能较少,处理速度较快。
MediaDeviceStateType
设备状态。
枚举值
- MediaDeviceStateIdle
- 0: 设备就绪。
- MediaDeviceStateActive
- 1: 设备正在使用。
- MediaDeviceStateDisabled
- 2: 设备被禁用。
- MediaDeviceStateNotPresent
- 4: 没有此设备。
- MediaDeviceStateUnplugged
- 8: 设备被拔出。
- MediaDeviceStateUnrecommended
- 16: 不推荐使用该设备。
MediaDeviceType
设备类型。
枚举值
- UnknownAudioDevice
- -1: 设备类型未知。
- AudioPlayoutDevice
- 0: 音频播放设备。
- AudioRecordingDevice
- 1: 音频采集设备。
- VideoRenderDevice
- 2: 视频渲染设备。
- VideoCaptureDevice
- 3: 视频采集设备。
MediaRecorderConfiguration
本地音视频流录制配置。
class MediaRecorderConfiguration { final String? storagePath; final MediaRecorderContainerFormat containerFormat; final MediaRecorderStreamType streamType; final int maxDurationMs; final int recorderInfoUpdateInterval; /// Constructs the [MediaRecorderConfiguration]. MediaRecorderConfiguration({ this.storagePath, this.containerFormat = MediaRecorderContainerFormat.MP4, this.streamType = MediaRecorderStreamType.Both, this.maxDurationMs = 120000, this.recorderInfoUpdateInterval = 0, }); factory MediaRecorderConfiguration.fromJson(Map<String, dynamic> json) => _$MediaRecorderConfigurationFromJson(json); Map<String, dynamic> toJson() => _$MediaRecorderConfigurationToJson(this); }
属性
- storagePath
- 录音文件在本地保存的绝对路径,需精确到文件名及格式。例如:
- Windows:
C:\Users\<user_name>\AppData\Local\Agora\<process_name>\example.mp4
- iOS:
/App Sandbox/Library/Caches/example.mp4
- macOS:
/Library/Logs/example.mp4
- Android:
/storage/emulated/0/Android/data/<package name>/files/example.mp4
注意: 请确保你指定的路径存在并且可写。 - Windows:
- containerFormat
- 录制文件的格式。详见 MediaRecorderContainerFormat。
- streamType
- 录制内容。详见 MediaRecorderStreamType。
- maxDurationMs
- 最大录制时长,单位为毫秒,默认值为 120,000。
- recorderInfoUpdateInterval
- 录制信息更新间隔,单位为毫秒,取值范围为 [1000,10000]。SDK 会根据该值的设置触发 onRecorderInfoUpdated 回调,报告更新后的录制信息。
NetworkType
网络连接类型。
枚举值
- Unknown
- -1: 网络连接类型未知。
- Disconnected
- 0: 网络连接已断开。
- LAN
- 1: 网络类型为 LAN。
- WIFI
- 2: 网络类型为 Wi-Fi (包含热点)。
- Mobile2G
- 3: 网络类型为 2G 移动网络。
- Mobile3G
- 4: 网络类型为 3G 移动网络。
- Mobile4G
- 5: 网络类型为 4G 移动网络。
VideoOutputOrientationMode
视频编码的方向模式。
枚举值
- Adaptative
-
0: (默认)该模式下 SDK 输出的视频方向与采集到的视频方向一致。接收端会根据收到的视频旋转信息对视频进行旋转。该模式适用于接收端可以调整视频方向的场景。
- 如果采集的视频是横屏模式,则输出的视频也是横屏模式。
- 如果采集的视频是竖屏模式,则输出的视频也是竖屏模式。
- FixedLandscape
- 1: 该模式下 SDK 固定输出风景(横屏)模式的视频。如果采集到的视频是竖屏模式,则视频编码器会对其进行裁剪。该模式适用于当接收端无法调整视频方向时,如使用旁路推流场景下。
- FixedPortrait
- 2: 该模式下 SDK 固定输出人像(竖屏)模式的视频,如果采集到的视频是横屏模式,则视频编码器会对其进行裁剪。该模式适用于当接收端无法调整视频方向时,如使用旁路推流场景下。
UserPriority
远端用户的需求优先级。
枚举值
- High
- 用户需求优先级为高。
- Normal
- (默认)用户需求优先级为正常。
ProxyType
代理类型。
枚举值
- None
- 0: 预留参数,暂不支持。
- UDP
- 1: UDP 协议的云代理,即 Force UDP 云代理模式。在该模式下,SDK 始终通过 UDP 协议传输数据。
- TCP
- 2: TCP(加密)协议的云代理,即 Force TCP 云代理模式。在该模式下,SDK 始终通过 TLS 443 传输数据。
- Local
- 3: 预留参数,暂不支持。
- TCPProxyAutoFallbackType
- 4: 自动模式。在该模式下,SDK 优先连接 SD-RTN™,如果连接失败,自动切换为 TLS 443。
VideoQualityAdaptIndication
自上次统计后本地视频质量的自适应情况(基于目标帧率和目标码率)。
枚举值
- AdaptNone
- 0:本地视频质量不变。
- AdaptUpBandwidth
- 1:因网络带宽增加,本地视频质量改善。
- AdaptDownBandwidth
- 2:因网络带宽减少,本地视频质量变差。
NetworkQuality
网络质量。
枚举值
- Unknown
- 0: 网络质量未知。
- Excellent
- 1: 网络质量极好。
- Good
- 2: 用户主观感觉和 excellent 差不多,但码率可能略低于 excellent。
- Poor
- 3: 用户主观感受有瑕疵但不影响沟通。
- Bad
- 4: 勉强能沟通但不顺畅。
- VBad
- 5: 网络质量非常差,基本不能沟通。
- Down
- 6: 完全无法沟通。
RecorderErrorCode
录制状态出错的原因。
枚举值
- None
- 0: 一切正常。
- WriteFailed
- 1: 录制文件写入失败。
- NoStream
- 2: 没有可录制的音视频流或者录制的音视频流中断超过 5 秒。
- OverMaxDuration
- 3: 录制时长超出上限。
- ConfigChanged
- 4: 录制配置改变。
- CustomStreamDetected
- 5: 在通信场景下,捕捉到 v3.0.0 之前版本的用户发送的音视频流。
RecorderState
当前的录制状态。
枚举值
- Error
- -1: 音视频流录制出错,错误原因详见 RecorderErrorCode。
- Start
- 2: 音视频流录制开始。
- Stop
- 3: 音视频流录制停止。
AudioRemoteStateReason
远端音频流状态切换原因。
枚举值
- Internal
- 0: 音频状态发生改变时,会报告该原因。
- NetworkCongestion
- 1: 网络阻塞。
- NetworkRecovery
- 2: 网络恢复正常。
- LocalMuted
- 3: 本地用户停止接收远端音频流或本地用户禁用音频模块。
- LocalUnmuted
- 4: 本地用户恢复接收远端音频流或本地用户启动音频模块。
- RemoteMuted
- 5: 远端用户停止发送音频流或远端用户禁用音频模块。
- RemoteUnmuted
- 6: 远端用户恢复发送音频流或远端用户启用音频模块。
- RemoteOffline
- 7: 远端用户离开频道。
AudioRemoteState
远端音频流状态。
枚举值
- Stopped
- 0: 远端音频默认初始状态。在 LocalMuted、RemoteMuted 或 RemoteOffline的情况下,会报告该状态。
- Starting
- 1: 本地用户已接收远端音频首包。
- Decoding
- 2: 远端音频流正在解码,正常播放。在 NetworkRecovery、LocalUnmuted 或 RemoteUnmuted 的情况下, 会报告该状态。
- Frozen
- 3: 远端音频流卡顿。在 NetworkCongestion 的情况下,会报告该状态。
- Failed
- 4: 远端音频流播放失败。在 Internal 的情况下,会报告该状态。
VideoRemoteStateReason
远端视频流状态切换原因。
枚举值
- Internal
- 0: 视频状态发生改变时,会报告该原因。
- NetworkCongestion
- 1: 远端用户的网络阻塞。如果网络状态持续不佳,请在应用中弹框显示“对方的网络状态不佳”。
- NetworkRecovery
- 2: 远端用户的网络恢复正常。请在应用中弹框显示“对方的网络状态恢复正常”。
- LocalMuted
- 3: 本地用户停止接收远端视频流或本地用户禁用视频模块。请关闭用于渲染该远端用户视频的窗口并在应用中弹框显示“你已停止接收对方视频”。
- LocalUnmuted
- 4: 本地用户恢复接收远端视频流或本地用户启动视频模块。请恢复用于渲染该远端用户视频的窗口并在应用中弹框显示“你已恢复接收对方视频”。
- RemoteMuted
- 5: 远端用户停止发送视频流或远端用户禁用视频模块。请关闭用于渲染该远端用户视频的窗口,在应用界面的用户列表中用图标显示该远端用户已停止发送视频,在应用中弹框显示“对应已关闭摄像头”。
- RemoteUnmuted
- 6: 远端用户恢复发送视频流或远端用户启用视频模块。请恢复用于渲染该远端用户视频的窗口,在应用界面的用户列表中用图标显示该远端用户已恢复发送视频,在应用中弹框显示“对应已开启摄像头”。
- RemoteOffline
- 7: 远端用户离开频道。请关闭用于渲染该远端用户视频的窗口,在应用界面的用户列表中移除该远端用户。
- AudioFallback
- 8: 弱网情况下,远端音视频流回退为音频流。请关闭用户渲染该远端用户视频的窗口,在应用中弹框显示“对方网络状态不佳”。
- AudioFallbackRecovery
- 9: 网络情况改善时,远端音频流恢复为音视频流。请恢复用于渲染该远端用户视频的窗口,在应用中弹框显示“对方网络状态恢复正常”。
VideoRemoteState
远端视频流状态。
枚举值
- Stopped
- 0: 远端视频默认初始状态。在 LocalMuted、RemoteMuted 或 RemoteOffline 的情况下,会报告该状态。
- Starting
- 1: 本地用户已接收远端视频首包。
- Decoding
- 2: 远端视频流正在解码,正常播放。在 NetworkRecovery、LocalUnmuted、RemoteUnmuted 或 AudioFallbackRecovery 的情况下, 会报告该状态。
- Frozen
- 3: 远端视频流卡顿。在 NetworkCongestion 或 AudioFallback 的情况下,会报告该状态。
- Failed
- 4: 远端视频流播放失败。在 Internal 的情况下,会报告该状态。
VideoStreamType
视频流类型。
枚举值
- High
- 0: 视频大流。
- Low
- 1: 视频小流。
VideoRenderMode
视频显示模式。
枚举值
- Hidden
- 1: 视频尺寸等比缩放。优先保证视窗被填满。因视频尺寸与显示视窗尺寸不一致而多出的视频将被截掉。
- Fit
- 2: 视频尺寸等比缩放。优先保证视频内容全部显示。因视频尺寸与显示视窗尺寸不一致造成的视窗未被填满的区域填充黑色。
- Adaptive
-
- 弃用:
- 3: 该模式已弃用。
- FILL
- 4: 视频尺寸进行缩放和拉伸以充满显示视窗。
RtmpStreamingErrorCode
推流错误信息。
枚举值
- OK
- 0:推流成功。
- InvalidParameters
- 1:参数无效。请检查输入参数是否正确。如果你在调用 addPublishStreamUrl 前没有调用 setLiveTranscoding 设置转码参数,SDK 会返回该错误。
- EncryptedStreamNotAllowed
- 2:推流已加密,不能推流。
- ConnectionTimeout
- 3:推流超时未成功。可调用 addPublishStreamUrl 重新推流。
- InternalServerError
- 4:推流服务器出现错误。请调用 addPublishStreamUrl 重新推流。
- RtmpServerError
- 5:CDN 服务器出现错误。
- TooOften
- 6:推流请求过于频繁。
- ReachLimit
- 7:单个主播的推流地址数目达到上限 10。请删掉一些不用的推流地址再增加推流地址。
- NotAuthorized
- 8:主播操作不属于自己的流。例如更新其他主播的流参数、停止其他主播的流。请检查 App 逻辑。
- StreamNotFound
- 9:服务器未找到这个流。
- FormatNotSupported
- 10:推流地址格式有错误。请检查推流地址格式是否正确。
- NotBroadcaster
- 11:用户角色不是主播,该用户无法使用推流功能。请检查你的应用代码逻辑。
- TranscodingNoMixStream
- 13:非转码推流情况下,调用了 updateRtmpTranscoding 或 setLiveTranscoding 方法更新转码属性。请检查你的应用代码逻辑。
- NetDown
- 14:主播的网络出错。
- InvalidAppid
- 15:你的 App ID 没有使用声网推流服务的权限。请参考旁路推流中的前提条件开启推流服务。
- UnPublishOK
- 100:推流已正常结束。当你调用 removePublishStreamUrl 结束推流后,SDK 会返回该值。
RtmpStreamingState
推流状态。
枚举值
- Idle
- 0:推流未开始或已结束。成功调用 removePublishStreamUrl 方法删除推流地址后,也会返回该状态。
- Connecting
- 1:正在连接声网推流服务器和 CDN 服务器。调用 addPublishStreamUrl 方法后,会返回该状态。
- Running
- 2:推流正在进行。成功推流后,会返回该状态。
- Recovering
-
3:正在恢复推流。当 CDN 出现异常,或推流短暂中断时,SDK 会自动尝试恢复推流,并返回该状态。
- 如成功恢复推流,则进入状态 Running(2)。
- 如服务器出错或 60 秒内未成功恢复,则进入状态 Failure(4)。如果觉得 60 秒太长,也可以主动调用 removePublishStreamUrl 和 addPublishStreamUrl 方法尝试重连。
- Failure
- 4:推流失败。失败后,你可以通过返回的错误码排查错误原因,也可以再次调用 addPublishStreamUrl 重新尝试推流。
- Disconnecting
- 5:SDK 正在与声网推流服务器和 CDN 服务器断开连接。 当你调用 removePublishStreamUrl 或 stopRtmpStream 方法正常结束推流时,SDK 会依次报告推流状态为 Disconnecting、Idle。
RtmpStreamingEvent
旁路推流时发生的事件。
枚举值
- FailedLoadImage
- 1: 旁路推流时,添加背景图或水印出错。
- UrlAlreadyInUse
- 2: 该推流 URL 已用于推流。如果你想开始新的推流,请使用新的推流 URL。
- AdvancedFeatureNotSupport
- 3: 功能不支持。
- RequestTooOften
- 4: 预留参数。
StreamFallbackOptions
音视频流回退处理选项。
枚举值
- Disabled
- 0: 上行/下行网络较弱时,不对音视频流作回退处理,但不能保证音视频流的质量。
- VideoStreamLow
- 1: 在下行网络条件较差时只接收视频小流(低分辨率、低码率视频流)。该选项只对 setRemoteSubscribeFallbackOption 有效。对 setLocalPublishFallbackOption 方法无效。
- AudioOnly
- 2: 上行/下行网络较弱时,先尝试只接收视频小流(低分辨率、低码率视频流);如果网络环境无法显示视频,则再回退到只接收远端订阅的音频流。
StreamPublishState
发布状态。
枚举值
- Idle
- 0: 加入频道后的初始发布状态。
- NoPublished
-
1: 发布失败。可能是因为:
- 本地用户调用 muteLocalAudioStream(
true
) 或 muteLocalVideoStream(true
) 停止发送本地媒体流。 - 本地用户调用 disableAudio 或 disableVideo 关闭本地音频或视频模块。
- 本地用户调用 enableLocalAudio(
false
) 或 enableLocalVideo(false
) 关闭本地音频或视频采集。 - 本地用户角色为观众。
- 本地用户调用 muteLocalAudioStream(
- Publishing
- 2: 正在发布。
- Published
- 3: 发布成功。
StreamSubscribeState
订阅状态。
枚举值
- Idle
- 0: 加入频道后的初始订阅状态。
- NoSubscribed
-
1: 订阅失败。可能是因为:
- 远端用户:
- 调用 muteLocalAudioStream(
true
) 或 muteLocalVideoStream(true
) 停止发送本地媒体流。 - 调用 disableAudio 或 disableVideo 关闭本地音频或视频模块。
- 调用 enableLocalAudio(false) 或 enableLocalVideo(false) 关闭本地音频或视频采集。
- 用户角色为观众。
- 调用 muteLocalAudioStream(
- 本地用户调用以下方法停止接收远端媒体流:
- 调用 muteRemoteAudioStream(true)、 muteAllRemoteAudioStreams(true) 或 setDefaultMuteAllRemoteAudioStreams(true) 停止接收远端音频流。
- 调用 muteRemoteVideoStream(true)、 muteAllRemoteVideoStreams(true) 或 setDefaultMuteAllRemoteVideoStreams(true) 停止接收远端视频流。
- 远端用户:
- Subscribing
- 2: 正在订阅。
- Subscribed
- 3: 收到了远端流,订阅成功。
SuperResolutionStateReason
超分辨率功能未成功开启的原因。
- 自从
- v3.5.1
枚举值
- Success
- 0: 超分辨率已成功开启。
- StreamOverLimitation
- 1: 远端用户的原始视频分辨率超出了可以应用超分辨率功能的范围。
- UserCountOverLimitation
- 2: 已对一个远端用户的视频使用超分辨率。
- DeviceNotSupported
- 3: 设备不支持使用超分辨率。
UploadErrorReason
日志文件上传失败的原因。
枚举值
- Success
- 0: 日志上传成功。
- NetError
- 1: 网络错误。请检查网络是否正常,并再次调用 uploadLogFile 进行重传。
- ServerError
- 2:声网服务器错误,请稍后尝试。
VoiceConversionPreset
预设的变声效果选项。
- 自从
- v3.3.1
枚举值
- Off
- 原声,即关闭变声效果。
- Neutral
- 中性。为避免音频失真,请确保仅对女声设置该效果。
- Sweet
- 甜美。为避免音频失真,请确保仅对女声设置该效果。
- Solid
- 稳重。为避免音频失真,请确保仅对男声设置该效果。
- Bass
- 低沉。为避免音频失真,请确保仅对男声设置该效果。
UserOfflineReason
用户离线原因。
枚举值
- Quit
- 0: 用户主动离开。
- Dropped
-
1: 因过长时间收不到对方数据包,超时掉线。
注意: 由于 SDK 使用的是不可靠通道,也有可能对方主动离开频道,但是本地没收到对方离开消息而误判为超时掉线。 - BecomeAudience
- 2: 用户身份从主播切换为观众。
VideoCodecProfileType
旁路推流输出视频的编解码规格。
- BaseLine
- 66: Baseline 级别的视频编码规格,一般用于低阶或需要额外容错的应用,比如视频通话、手机视频等。
- Main
- 77: Main 级别的视频编码规格,一般用于主流消费类电子产品,如 MP4、便携的视频播放器、PSP、iPad 等。
- High
- 100: (默认)High 级别的视频编码规格,一般用于广播、视频碟片存储、高清电视。
VideoCodecType
视频编码格式。
枚举值
- VP8
- 标准 VP8。
- H264
- 标准 H.264。
- EVP
- 增强 VP8。
- E264
- 增强 H.264。
VideoCodecTypeForStream
转码输出视频流的编解码类型。
枚举值
- H264
- 1:(默认)H.264。
- H265
- 2:H.265。
VideoContentHint
屏幕共享的内容类型。
枚举值
- None
- (默认)无指定的内容类型。
- Motion
- 内容类型为动画。当共享的内容是视频、电影或视频游戏时,推荐选择该内容类型。
- Details
- 内容类型为细节。当共享的内容是图片或文字时,推荐选择该内容类型。
VideoMirrorMode
镜像模式类型。
枚举值
- Auto
- 0:(默认)由 SDK 决定镜像模式。
- Enabled
- 1: 启用镜像模式。
- Disabled
- 2: 关闭镜像模式。
VideoDenoiserMode
视频降噪模式。
枚举值
- Auto
- 0:(默认)自动模式。SDK 会根据环境光亮度自动开启或关闭视频降噪功能。
- Manual
- 手动模式。用户需手动开启或关闭视频降噪功能。
VideoDenoiserLevel
视频降噪等级。
枚举值
- HighQuality
- 0:(默认)优先画质的视频降噪。HighQuality 是在性能消耗和视频降噪效果中取平衡的等级。性能消耗适中,视频降噪速度适中,综合画质最优。
- Fast
- 优先性能的视频降噪。Fast 是在性能消耗和视频降噪效果中侧重于节省性能的等级。性能消耗较少,视频降噪速度较快。为避免处理后的视频有明显的拖影效果,声网推荐你在摄像头固定的情况下使用 Fast。
- Strength
- 强效的视频降噪。Strength 是在性能消耗和视频降噪效果中侧重于视频降噪效果的等级。性能消耗较多,视频降噪速度较慢,视频降噪效果较好。如果 HighQuality 不能满足你的视频降噪需求,你可以使用 Strength。
VoiceBeautifierPreset
预设的美声效果选项。
枚举值
- VoiceBeautifierOff
- 原声,即关闭美声效果。
- ChatBeautifierMagnetic
-
磁性(男)。
注意: 该设置仅对男声有效,请勿用于设置女声,否则音频会失真。 - ChatBeautifierFresh
-
清新(女)。
注意: 该设置仅对女声有效,请勿用于设置男声,否则音频会失真。 - ChatBeautifierVitality
-
活力(女)。
注意: 该设置仅对女声有效,请勿用于设置男声,否则音频会失真。 - SingingBeautifier
-
- 自从
- v3.3.0
歌唱美声。
- 如果调用 setVoiceBeautifierPreset(SingingBeautifier),你可以美化男声并添加歌声在小房间的混响效果。请勿用于设置女声,否则音频会失真。
- 如果调用 setVoiceBeautifierParameters(SingingBeautifier, param1, param2),你可以美化男声或女声并添加混响效果。
- TimbreTransformationVigorous
- 浑厚。
- TimbreTransformationDeep
- 低沉。
- TimbreTransformationMellow
- 圆润。
- TimbreTransformationFalsetto
- 假音。
- TimbreTransformationFull
- 饱满。
- TimbreTransformationClear
- 清澈。
- TimbreTransformationResounding
- 高亢。
- TimbreTransformationRinging
- 嘹亮。
AudioVoiceChanger
预设的语音变声效果。
- 弃用
- 自 v3.2.0 废弃。
枚举值
- Off
- 原声,即关闭语音变声。
- OldMan
- 变声:老男人。
- BabyBoy
- 变声:小男孩。
- BabyGirl
- 变声:小女孩。
- ZhuBaJie
- 变声:猪八戒。
- Ethereal
- 变声:空灵。
- Hulk
- 变声:绿巨人。
- BEAUTY_VIGOROUS
- 美音:浑厚。
- BEAUTY_DEEP
- 美音:深沉。
- BEAUTY_MELLOW
- 美音:圆润。
- BEAUTY_FALSETTO
- 美音:假音。
- BEAUTY_FULL
- 美音:饱满。
- BEAUTY_CLEAR
- 美音:清澈。
- BEAUTY_RESOUNDING
- 美音:高亢。
- BEAUTY_RINGING
- 美音:嘹亮。
- BEAUTY_SPACIAL
- 美音:空旷。
- GENERAL_BEAUTY_VOICE_MALE_MAGNETIC
- 语聊美声:磁性(男)。此枚举为男声定制化效果,不适用于女声。若女声使用此音效设置,则音频可能会产生失真。
- GENERAL_BEAUTY_VOICE_FEMALE_FRESH
- 语聊美声:清新(女)。此枚举为女声定制化效果,不适用于男声。若男声使用此音效设置,则音频可能会产生失真。
- GENERAL_BEAUTY_VOICE_FEMALE_VITALITY
- 语聊美声:活力(女)。此枚举为女声定制化效果,不适用于男声。若男声使用此音效设置,则音频可能会产生失真。
WlaccMessageReason
Wi-Fi 连接质量不佳的原因。
枚举值
- WeakSignal
- 0: Wi-Fi 信号弱。
- ChannelCongestion
- 1: 网络拥塞。
WlaccSuggestAction
改善 Wi-Fi 连接质量的操作建议。
枚举值
- CloseToWifi
- 0: 由于路由器接收到的 Wi-Fi 信号弱,请用户靠近路由器。
- ConnectSsid
- 1: 请用户连接到指定的无线网络。无线网络名称(SSID)详见
wlAccMsg
参数。 - Check5g
- 2: 当前路由器不支持 5G 频道。请用户检查路由器是否支持并开启了 5G 频道,或更换支持 5G 频道的路由器。开启 5G 频道的步骤详见
wlAccMsg
参数。 - ModifySsid
- 3: 2.4G 频段和 5G 频道的网络名称(SSID)相同。请用户修改 2.4G 频段或 5G 频道的网络名称。修改步骤详见
wlAccMsg
参数。
AudioFileInfo
音频文件信息。在 requestAudioFileInfo 中报告。
class AudioFileInfo { @JsonKey() String filePath; @JsonKey() int durationMs; AudioFileInfo({ required this.filePath, required this.durationMs, }); factory AudioFileInfo.fromJson(Map<String, dynamic> json) => _$AudioFileInfoFromJson(json); Map<String, dynamic> toJson() => _$AudioFileInfoToJson(this); }
属性
- filePath
- 音频文件路径。
- durationMs
- 音频文件时长 (ms)。
AudioVolumeInfo
用户音量信息。
class AudioVolumeInfo { int uid; int volume; int vad; String channelId; AudioVolumeInfo( this.uid, this.volume, this.vad, this.channelId, ); factory AudioVolumeInfo.fromJson(Map<String, dynamic> json) => _$AudioVolumeInfoFromJson(json); Map<String, dynamic> toJson() => _$AudioVolumeInfoToJson(this); }
属性
- uid
-
用户 ID。
- 在本地用户的回调中,uid 为 0。
- 在远端用户的回调中,uid 为瞬时音量最高的远端用户(最多 3 位)的 ID。
- volume
- 用户的音量,取值范围为 [0,255]。
- vad
-
本地用户的人声状态。
- 0:本地无人声。
- 1:本地有人声。
注意:- vad 无法报告远端用户的人声状态。对于远端用户,vad 的值始终为 0。
- 如需使用此参数,请在调用 enableAudioVolumeIndication 时设置 为
true
。
- channelId
- 用户所在频道的频道名称。
BeautyOptions
美颜选项。
class BeautyOptions { @JsonKey(includeIfNull: false) LighteningContrastLevel? lighteningContrastLevel; @JsonKey(includeIfNull: false) double? lighteningLevel; @JsonKey(includeIfNull: false) double? smoothnessLevel; @JsonKey(includeIfNull: false) double? rednessLevel; BeautyOptions({ this.lighteningContrastLevel, this.lighteningLevel, this.smoothnessLevel, this.rednessLevel, }); factory BeautyOptions.fromJson(Map<String, dynamic> json) => _$BeautyOptionsFromJson(json); Map<String, dynamic> toJson() => _$BeautyOptionsToJson(this); }
属性
- lighteningContrastLevel
-
对比度,常与
lighteningLevel
搭配使用。取值越大,明暗对比程度越大。详见 LighteningContrastLevel。 - lighteningLevel
- 美白程度,取值范围为 [0.0,1.0],其中 0.0 表示原始亮度,默认值为 。取值越大,美白程度越大。
- smoothnessLevel
- 磨皮程度,取值范围为 [0.0,1.0],其中 0.0 表示原始磨皮程度,默认值为 0.5。取值越大,磨皮程度越大。
- rednessLevel
- 红润度,取值范围为 [0.0,1.0],其中 0.0 表示原始红润度,默认值为 0.1。取值越大,红润程度越大。
FacePositionInfo
检测到的人脸信息。
class FacePositionInfo { int x; int y; int width; int height; int distance; FacePositionInfo( this.x, this.y, this.width, this.height, this.distance, ); factory FacePositionInfo.fromJson(Map<String, dynamic> json) => _$FacePositionInfoFromJson(json); Map<String, dynamic> toJson() => _$FacePositionInfoToJson(this); }
属性
- x
-
人脸在画面中的 x 坐标 (px)。以摄像头采集画面的左上角为原点,x 坐标为人脸左上角相对于原点的横向位移。
- y
-
人脸在画面中的 y 坐标 (px)。以摄像头采集画面的左上角为原点,y 坐标为人脸左上角相对原点的纵向位移。
- width
-
人脸在画面中的宽度 (px)。
- height
-
人脸在画面中的高度 (px)。
- distance
-
人脸距设备屏幕的距离 (cm)。
CameraCapturerConfiguration
摄像头采集配置。
class CameraCapturerConfiguration { @JsonKey(includeIfNull: false) CameraCaptureOutputPreference? preference; @JsonKey(includeIfNull: false) int? captureWidth; @JsonKey(includeIfNull: false) int? captureHeight; @JsonKey(includeIfNull: false) CameraDirection? cameraDirection; CameraCapturerConfiguration({ this.preference, this.captureWidth, this.captureHeight, this.cameraDirection, }); factory CameraCapturerConfiguration.fromJson(Map<String, dynamic> json) => _$CameraCapturerConfigurationFromJson(json); Map<String, dynamic> toJson() => _$CameraCapturerConfigurationToJson(this); }
属性
- preference
- 摄像头采集偏好。详见 CameraCaptureOutputPreference。
- captureWidth
-
- 自从
- v3.3.0
本地采集的视频宽度 (px)。如果你需要自定义本地采集的视频宽度,请先将 preference 设为 Manual(3),再通过 captureWidth 设置采集的视频宽度。
- captureHeight
-
- 自从
- v3.3.0
本地采集的视频高度 (px)。如果你需要自定义本地采集的视频高度,请先将 preference 设为 Manual(3),再通过 captureHeight 设置采集的视频高度。
- cameraDirection
-
该参数仅适用于 Android 和 iOS 平台。
摄像头方向。详见 CameraDirection。
ChannelMediaInfo
ChannelMediaInfo 类定义。
class ChannelMediaInfo { String channelName; @JsonKey(includeIfNull: false) String? token; int uid; ChannelMediaInfo( this.channelName, this.uid, { this.token, }); factory ChannelMediaInfo.fromJson(Map<String, dynamic> json) => _$ChannelMediaInfoFromJson(json); Map<String, dynamic> toJson() => _$ChannelMediaInfoToJson(this); }
属性
- channelName
- 频道名。
- token
- 能加入频道的 Token。
- uid
- 用户 ID。
ChannelMediaOptions
频道媒体设置选项。
class ChannelMediaOptions { @JsonKey(includeIfNull: false) bool? autoSubscribeAudio; @JsonKey(includeIfNull: false) bool? autoSubscribeVideo; @JsonKey(includeIfNull: false) bool? publishLocalAudio; @JsonKey(includeIfNull: false) bool? publishLocalVideo; ChannelMediaOptions({ this.autoSubscribeAudio, this.autoSubscribeVideo, this.publishLocalAudio, this.publishLocalVideo, }); factory ChannelMediaOptions.fromJson(Map<String, dynamic> json) => _$ChannelMediaOptionsFromJson(json); Map<String, dynamic> toJson() => _$ChannelMediaOptionsToJson(this); }
- 自从
- v3.0.0
属性
- autoSubscribeAudio
- 是否自动订阅频道内所有远端音频流:
true
:(默认)订阅。false
: 不订阅。
- audioSubscribeVideo
- 是否自动订阅频道内所有远端视频流:
true
:(默认)订阅。false
: 不订阅。
- publishLocalAudio
- 是否自动在频道没发布本地音频流:
true
:(默认)发布。false
: 不发布。
该成员功能与 muteLocalAudioStream 相同。加入频道后,你可以通过
muteLocalAudioStream
方法重新设置是否在频道内发布本地音频流。 - publishLocalVideo
- 是否自动在频道没发布本地视频流:
true
:(默认)发布。false
: 不发布。
该成员功能与 muteLocalVideoStream 相同。加入频道后,你可以通过
muteLocalVideoStream
方法重新设置是否在频道内发布本地视频流。
ChannelMediaRelayConfiguration
ChannelMediaRelayConfiguration 类定义。
class ChannelMediaRelayConfiguration { ChannelMediaInfo srcInfo; List<ChannelMediaInfo> destInfos; ChannelMediaRelayConfiguration( this.srcInfo, this.destInfos, ); factory ChannelMediaRelayConfiguration.fromJson(Map<String, dynamic> json) => _$ChannelMediaRelayConfigurationFromJson(json); Map<String, dynamic> toJson() => _$ChannelMediaRelayConfigurationToJson(this); }
属性
-
源频道信息 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,可直接将该参数设为默认值
-
目标频道信息 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,可直接将该参数设为默认值
ClientRoleOptions
用户角色具体设置。
class ClientRoleOptions { @JsonKey(includeIfNull: false) AudienceLatencyLevelType? audienceLatencyLevel; ClientRoleOptions({ this.audienceLatencyLevel, }); factory ClientRoleOptions.fromJson(Map<String, dynamic> json) => _$ClientRoleOptionsFromJson(json); Map<String, dynamic> toJson() => _$ClientRoleOptionsToJson(this); }
属性
- audienceLatencyLevel
- 观众端延时级别。详见 AudienceLatencyLevelType。
ColorEnhanceOptions
色彩增强选项。
class ColorEnhanceOptions { final double strengthLevel; final double skinProtectLevel; const ColorEnhanceOptions( {this.strengthLevel = 0.0, this.skinProtectLevel = 1.0}); factory ColorEnhanceOptions.fromJson(Map<String, dynamic> json) => _$ColorEnhanceOptionsFromJson(json); Map<String, dynamic> toJson() => _$ColorEnhanceOptionsToJson(this); }
属性
- strengthLevel
- 色彩增强程度。取值范围为 [0.0,1.0]。
0.0
为默认值,表示不对视频进行色彩增强。取值越大,色彩增强的程度越大。 - skinProtectLevel
- 肤色保护程度。取值范围为 [0.0,1.0]。
0.0
表示不对肤色进行保护。取值越大,肤色保护的程度越大。默认值为1.0
。色彩增强程度较大时,人像肤色会明显失真,你需要设置肤色保护程度;肤色保护程度较大时,色彩增强效果会略微降低。因此,为获取最佳的色彩增强效果,声网建议你调节 strengthLevel 和 skinProtectLevel 以获取最合适的取值。
ContentInspectConfig
视频截图上传配置。
class ContentInspectConfig { final String? extraInfo; final List<ContentInspectModule> modules; final int moduleCount; const ContentInspectConfig( {required this.modules, this.extraInfo, this.moduleCount = 0}); factory ContentInspectConfig.fromJson(Map<String, dynamic> json) => _$ContentInspectConfigFromJson(json); Map<String, dynamic> toJson() => _$ContentInspectConfigToJson(this); }
属性
- extraInfo
-
附加信息,最大长度为 1024 字节。
SDK 会将附加信息和截图一起上传至声网服务器;截图完成后,声网服务器会将附加信息随回调通知一起发送给你的服务器。
- modules
-
功能模块。详见 ContentInspectModule 。
注: 一个功能模块最多只能配置一个实例。目前仅支持截图上传功能。 - moduleCount
- 功能模块数,即配置的 ContentInspectModule 实例的数量。必须与 modules 中配置的实例个数一致。最大值为 32。
ContentInspectModule
ContentInspectModule 结构体,用于配置视频截图上传的频率。
class ContentInspectModule { final int type; final int interval; const ContentInspectModule({this.type = 0, this.interval = 0}); factory ContentInspectModule.fromJson(Map<String, dynamic> json) => _$ContentInspectModuleFromJson(json); Map<String, dynamic> toJson() => _$ContentInspectModuleToJson(this); }
- 自从
- v3.5.2
属性
- type
- 功能模块的类型,详见 ContentInspectType。
- interval
- 视频截图上传的间隔,单位为秒,取值必须大于 0。默认值为 0,表示不进行截图上传。推荐值为 10 秒,你也可以根据业务需求自行调整。
ContentInspectType
功能模块的类型:
属性
- kContentInspectInvalid
0
: (默认)该功能模块无实际功能。请不要将type
设为该值。- kContentInspectSupervise
2
: 截图。SDK 会对视频流进行截图并上传。
DataStreamConfig
数据流设置。
class DataStreamConfig { bool syncWithAudio; bool ordered; DataStreamConfig( this.syncWithAudio, this.ordered, ); factory DataStreamConfig.fromJson(Map<String, dynamic> json) => _$DataStreamConfigFromJson(json); Map<String, dynamic> toJson() => _$DataStreamConfigToJson(this); }
下表展示不同的参数设置下,SDK 的行为:
syncWithAudio |
ordered |
SDK 行为 |
---|---|---|
false |
false |
接收端接收到数据包后,SDK 立刻触发 streamMessage 回调。 |
true |
false |
如果数据包的延迟在音频延迟的范围内,SDK 会在播放音频的同时触发与该音频包同步的 streamMessage 回调。如果数据包的延迟超出了音频延迟,SDK 会在接收到该数据包时立刻触发 streamMessage 回调;此情况会造成音频包和数据包的不同步。 |
false |
true |
如果数据包的延迟在 5 秒以内,SDK 会修正数据包的乱序问题。如果数据包的延迟超出 5 秒,SDK 会丢弃该数据包。 |
true |
true |
如果数据包的延迟在音频延迟的范围内,SDK 会修正数据包的乱序问题。如果数据包的延迟超出音频延迟,SDK 会丢弃该数据包。 |
属性
- syncWithAudio
-
是否与本地发送的音频流同步。
true
: 数据流与音频流同步。false
: 数据流与音频流不同步。
- ordered
-
是否保证接收到的数据按发送的顺序排列。
true
: 保证 SDK 按照发送方发送的顺序输出数据包。false
: 不保证 SDK 按照发送方发送的顺序输出数据包。
true
。
EncryptionConfig
配置内置加密模式和密钥。
class EncryptionConfig { @JsonKey(includeIfNull: false) EncryptionMode? encryptionMode; @JsonKey(includeIfNull: false) String? encryptionKey; @JsonKey(includeIfNull: false) List<int>? encryptionKdfSalt; EncryptionConfig({ this.encryptionMode, this.encryptionKey, this.encryptionKdfSalt, }); factory EncryptionConfig.fromJson(Map<String, dynamic> json) => _$EncryptionConfigFromJson(json); Map<String, dynamic> toJson() => _$EncryptionConfigToJson(this); }
属性
- encryptionMode
-
内置加密模式。详见 EncryptionMode。声网推荐使用
AES128GCM2
或AES256GCM2
加密模式。这两种模式支持使用盐,安全性更高。 - encryptionKey
-
内置加密密钥,字符串类型。
注意: 如果未指定该参数或将该参数设置为null
,则无法启用内置加密,且 SDK 会返回错误码-2
。 - encryptionKdfSalt
-
- 自从
- v3.4.5
盐,长度为 32 字节。声网推荐你在服务端使用 OpenSSL 生成盐,详见《媒体流加密》。
注意: 只有在AES128GCM2
或AES256GCM2
加密模式下,该参数才生效。此时,需确保填入该参数的值不全为0
。
LastmileProbeConfig
Last mile 网络探测配置。
class LastmileProbeConfig { bool probeUplink; bool probeDownlink; int expectedUplinkBitrate; int expectedDownlinkBitrate; LastmileProbeConfig( this.probeUplink, this.probeDownlink, this.expectedUplinkBitrate, this.expectedDownlinkBitrate, ); factory LastmileProbeConfig.fromJson(Map<String, dynamic> json) => _$LastmileProbeConfigFromJson(json); Map<String, dynamic> toJson() => _$LastmileProbeConfigToJson(this); }
属性
- probeUplink
-
是否探测上行网络。有些用户,如直播频道中的普通观众,不需要进行网络探测:
true
: 探测。false
: 不探测。
- probeDownlink
-
是否探测下行网络。
true
: 探测。false
: 不探测。
- expectedUplinkBitrate
- 用户期望的最高发送码率,单位为 bps,范围为 [100000,5000000]。声网推荐参考 setVideoEncoderConfiguration 中的码率值设置该参数的值。
- expectedDownlinkBitrate
- 用户期望的最高接收码率,单位为 bps,范围为 [100000,5000000]。
LastmileProbeOneWayResult
上行或下行 Last mile 网络质量探测结果。
class LastmileProbeOneWayResult { int packetLossRate; int jitter; int availableBandwidth; LastmileProbeOneWayResult( this.packetLossRate, this.jitter, this.availableBandwidth, ); factory LastmileProbeOneWayResult.fromJson(Map<String, dynamic> json) => _$LastmileProbeOneWayResultFromJson(json); Map<String, dynamic> toJson() => _$LastmileProbeOneWayResultToJson(this); }
属性
- packetLossRate
- 丢包率。
- jitter
- 网络抖动 (ms)。
- availableBandwidth
- 可用网络带宽预估 (bps)。
LastmileProbeResult
上下行 Last mile 网络质量探测结果。
class LastmileProbeResult { LastmileProbeResultState state; int rtt; LastmileProbeOneWayResult uplinkReport; LastmileProbeOneWayResult downlinkReport; LastmileProbeResult( this.state, this.rtt, this.uplinkReport, this.downlinkReport, ); factory LastmileProbeResult.fromJson(Map<String, dynamic> json) => _$LastmileProbeResultFromJson(json); Map<String, dynamic> toJson() => _$LastmileProbeResultToJson(this); }
属性
- state
- uplinkReport
- 上行网络质量报告。详见 LastmileProbeOneWayResult。
- downlinkReport
- 下行网络质量报告。详见 LastmileProbeOneWayResult。
- rtt
- 往返时延 (ms)。
LiveTranscoding
旁路推流的转码属性。
class LiveTranscoding { @JsonKey(includeIfNull: false) int? width; @JsonKey(includeIfNull: false) int? height; @JsonKey(includeIfNull: false) int? videoBitrate; @JsonKey(includeIfNull: false) VideoFrameRate? videoFramerate; @Deprecated( 'This attribute is deprecated since v2.8.0, and Agora does not recommend it.') @JsonKey(includeIfNull: false) bool? lowLatency; @JsonKey(includeIfNull: false) int? videoGop; @JsonKey(includeIfNull: false) List<AgoraImage>? watermark; @JsonKey(includeIfNull: false) List<AgoraImage>? backgroundImage; @JsonKey(includeIfNull: false) AudioSampleRateType? audioSampleRate; @JsonKey(includeIfNull: false) int? audioBitrate; @JsonKey(includeIfNull: false) AudioChannel? audioChannels; @JsonKey(includeIfNull: false) AudioCodecProfileType? audioCodecProfile; @JsonKey(includeIfNull: false) VideoCodecProfileType? videoCodecProfile; @JsonKey(includeIfNull: false) int? backgroundColor; @JsonKey(includeIfNull: false) VideoCodecTypeForStream? videoCodecType; @JsonKey(includeIfNull: false) String? userConfigExtraInfo; List<TranscodingUser> transcodingUsers; LiveTranscoding( this.transcodingUsers, { this.width, this.height, this.videoBitrate, this.videoFramerate, this.lowLatency, this.videoGop, this.watermark, this.backgroundImage, this.audioSampleRate, this.audioBitrate, this.audioChannels, this.audioCodecProfile, this.videoCodecProfile, this.backgroundColor, this.videoCodecType, this.userConfigExtraInfo, }); factory LiveTranscoding.fromJson(Map<String, dynamic> json) => _$LiveTranscodingFromJson(json); Map<String, dynamic> toJson() => _$LiveTranscodingToJson(this); }
属性
- width
-
推流视频的总宽度,默认值 360,单位为像素。
- 如果推视频流,
width
取值范围为 [64,1920]。如果取值低于 64,声网服务器会自动调整为 64; 如果取值高于 1920,声网服务器会自动调整为 1920。 - 如果推音频流,请将
width
和height
设为 0。
- 如果推视频流,
- height
-
推流视频的总高度,默认值 640,单位为像素。
- 如果推视频流,
height
取值范围为 [64,1080]。如果取值低于 64,声网服务器会自动调整为 64; 如果取值高于 1080,声网服务器会自动调整为 1080。 - 如果推音频流,请将
width
和height
设为 0。
- 如果推视频流,
- videoBitrate
-
用于旁路直播的输出视频的码率。单位为 Kbps。400 Kbps 为默认值。
你可以参考旁路推流设置该参数的值。
- videoFramerate
-
用于旁路直播的输出视频的帧率。取值范围是 (0,30],单位为 fps。15 fps 为默认值。
注意: 声网服务器会将高于 30 fps 的帧率统一调整为 30 fps。 - lowLatency
-
- 弃用
- 声网不推荐使用。
低延时模式
true
: 低延时,不保证画质。false
:(默认值)高延时,保证画质。
- videoGop
- 用于旁路直播的输出视频的 GOP(Group of Pictures)。单位为帧。默认值为 30。
- videoCodecProfile
-
用于旁路直播的输出视频的编码规格。可以设置为 66、77 或 100,详见 VideoCodecProfileType。
注意: 如果你把这个参数设为其他值,声网服务器会将其调整为默认值。 - videoCodecType
- 用于旁路直播的输出视频的编解码类型。详见 VideoCodecTypeForStream。
- transcodingUsers
-
用于管理参与旁路直播的视频转码合图的用户。最多支持 17 人同时参与转码合图。详见 TranscodingUser。
- transcodingExtraInfo
-
预留参数:用户自定义的发送到旁路推流客户端的信息,用于填充 H264/H265 视频中 SEI 帧内容。长度限制:4096 字节。关于 SEI 的详细信息,详见 SEI 帧相关问题。
- backgroundColor
-
用于旁路直播的输出视频的背景色,格式为 RGB 定义下的十六进制整数,不要带 # 号,如 0xFFB6C1 表示浅粉色。默认0x000000,黑色。
- backgroundImage
- 直播视频上的背景图。详见 AgoraImage。你可以添加一张背景图,或使用数组的方式添加多张背景图。该参数与 backgroundImageCount 搭配使用。
- watermark
- watermark
-
直播视频上的水印。必须为 PNG 格式。详见 AgoraImage。
你可以添加一个水印,或使用数组的方式添加多个水印。该参数与 watermarkCount搭配使用。
- audioSampleRate
-
用于旁路推流的输出媒体流的音频采样率 (Hz),详见 AudioSampleRateType。
- audioBitrate
-
用于旁路直播的输出音频的码率。单位为 Kbps,默认值为 48,最大值为 128。
- audioChannels
-
用于旁路直播的输出音频的声道数,默认值为 1。取值范围为 [1,5] 中的整型,建议取 1 或 2。3、4、5 需要特殊播放器支持:
- 1: (默认)单声道
- 2: 双声道
- 3: 三声道
- 4: 四声道
- 5: 五声道
- audioCodecProfile
- 用于旁路直播输出音频的编码规格。详见 AudioCodecProfileType。
- userConfigExtraInfo
- 预留参数。 用户自定义的发送到旁路推流客户端的信息,用于填充 H264/H265 视频中 SEI 帧内容。长度限制:4096字节。
LocalAudioStats
本地音频统计数据。
class LocalAudioStats { int numChannels; int sentSampleRate; int sentBitrate; int txPacketLossRate; LocalAudioStats( this.numChannels, this.sentSampleRate, this.sentBitrate, this.txPacketLossRate, ); factory LocalAudioStats.fromJson(Map<String, dynamic> json) => _$LocalAudioStatsFromJson(json); Map<String, dynamic> toJson() => _$LocalAudioStatsToJson(this); }
属性
- numChannels
- 声道数。
- sentSampleRate
- 发送本地音频的采样率,单位为 Hz。
- sentBitrate
- 发送本地音频的码率平均值,单位为 Kbps。
- txPacketLossRate
- 弱网对抗前本端到声网边缘服务器的丢包率 (%)。
LocalVideoStats
本地视频流统计信息。
class LocalVideoStats { int sentBitrate; int sentFrameRate; int encoderOutputFrameRate; int rendererOutputFrameRate; int targetBitrate; int targetFrameRate; VideoQualityAdaptIndication qualityAdaptIndication; int encodedBitrate; int encodedFrameWidth; int encodedFrameHeight; int encodedFrameCount; VideoCodecType codecType; int txPacketLossRate; int captureFrameRate; CaptureBrightnessLevelType captureBrightnessLevel; LocalVideoStats( this.sentBitrate, this.sentFrameRate, this.encoderOutputFrameRate, this.rendererOutputFrameRate, this.targetBitrate, this.targetFrameRate, this.qualityAdaptIndication, this.encodedBitrate, this.encodedFrameWidth, this.encodedFrameHeight, this.encodedFrameCount, this.codecType, this.txPacketLossRate, this.captureFrameRate, this.captureBrightnessLevel, ); factory LocalVideoStats.fromJson(Map<String, dynamic> json) => _$LocalVideoStatsFromJson(json); Map<String, dynamic> toJson() => _$LocalVideoStatsToJson(this); }
属性
- sentBitrate
-
实际发送码率 (Kbps)注意: 不包含丢包后重传视频等的发送码率。
- sentFrameRate
- 实际发送帧率 (fps)。
注意: 不包含丢包后重传视频等的发送帧率。
- encoderOutputFrameRate
- 本地视频编码器的输出帧率,单位为 fps。
- rendererOutputFrameRate
- 本地视频渲染器的输出帧率,单位为 fps。
- targetBitrate
- 当前编码器的目标编码码率 (Kbps),该码率为 SDK 根据当前网络状况预估的一个值。
- targetFrameRate
- 当前编码器的目标编码帧率 (fps)。
- qualityAdaptIndication
- 统计周期内本地视频质量(基于目标帧率和目标码率)的自适应情况。
- encodedBitrate
-
视频编码码率(Kbps)。注意: 不包含丢包后重传视频等的编码码率。
- encodedFrameWidth
- 视频编码宽度(px)。
- encodedFrameHeight
- 视频编码高度(px)。
- encodedFrameCount
- 视频发送的帧数,累计值。
- codecType
- 视频的编码类型。
- txPacketLossRate
- 弱网对抗前本端到声网边缘服务器的视频丢包率 (%)。
- captureFrameRate
- 本地视频采集帧率 (fps)。
- captureBrightnessLevel
-
本地采集的画质亮度级别。详见 CaptureBrightnessLevelType。
LogConfig
声网 SDK 日志文件的配置。
class LogConfig { @JsonKey(includeIfNull: false) String? filePath; @JsonKey(includeIfNull: false) int? fileSize; @JsonKey(includeIfNull: false) LogLevel? level; LogConfig({ this.filePath, this.fileSize, this.level, }); factory LogConfig.fromJson(Map<String, dynamic> json) => _$LogConfigFromJson(json); Map<String, dynamic> toJson() => _$LogConfigToJson(this); }
- 自从
- v3.3.0
属性
- filePath
-
日志文件的绝对路径或相对路径(以 \ 或 / 结尾)。请确保你指定的目录存在且可写。你可以通过该参数修改日志文件名。
- 单个日志文件的大小,单位为 KB。默认值为 2014 KB。如果你将 fileSize 设为 1024 KB,SDK 会最多输出总计 5 MB 的日志文件。如果你将 fileSize 设为小于 1024 KB,则设置不生效,单个日志文件最大仍为 1024 KB。
- level
- 声网 SDK 的日志输出等级,详见 LogLevel。
LowLightEnhanceOptions
暗光增强选项。
class LowLightEnhanceOptions { final LowLightEnhanceMode mode; final LowLightEnhanceLevel level; const LowLightEnhanceOptions( {this.mode = LowLightEnhanceMode.Auto, this.level = LowLightEnhanceLevel.HighQuality}); factory LowLightEnhanceOptions.fromJson(Map<String, dynamic> json) => _$LowLightEnhanceOptionsFromJson(json); Map<String, dynamic> toJson() => _$LowLightEnhanceOptionsToJson(this); }
属性
- level
-
暗光增强等级。详见 LowLightEnhanceLevel。
- mode
-
暗光增强模式。详见 LowLightEnhanceMode。
Metadata
媒体附属信息。
class Metadata { int uid; @JsonKey(ignore: true) Uint8List? buffer; int timeStampMs; Metadata(this.uid, this.timeStampMs); factory Metadata.fromJson(Map<String, dynamic> json) => _$MetadataFromJson(json); Map<String, dynamic> toJson() => _$MetadataToJson(this); }
属性
- uid
-
用户 ID。
- 对于接收者:发送该 Metadata 的远端用户的 ID。
- 对于发送者:请忽略。
- size
- 接收到的或发送的 Metadata 的缓存大小。
- buffer
- 接收到的或发送的 Metadata 的缓存地址。
- timeStampMs
- Metadata 的时间戳,单位为毫秒。
MediaDeviceInfo
MediaDeviceInfo 类,包含设备 ID 和设备名称。
class MediaDeviceInfo { String deviceId; String deviceName; MediaDeviceInfo( this.deviceId, this.deviceName, ); factory MediaDeviceInfo.fromJson(Map<String, dynamic> json) => _$MediaDeviceInfoFromJson(json); Map<String, dynamic> toJson() => _$MediaDeviceInfoToJson(this); }
属性
- deviceId
- 设备 ID。
- deviceName
- 设备名称。
MediaRecorderConfiguration
本地音视频流录制配置。
class MediaRecorderConfiguration { final String? storagePath; final MediaRecorderContainerFormat containerFormat; final MediaRecorderStreamType streamType; final int maxDurationMs; final int recorderInfoUpdateInterval; /// Constructs the [MediaRecorderConfiguration]. MediaRecorderConfiguration({ this.storagePath, this.containerFormat = MediaRecorderContainerFormat.MP4, this.streamType = MediaRecorderStreamType.Both, this.maxDurationMs = 120000, this.recorderInfoUpdateInterval = 0, }); factory MediaRecorderConfiguration.fromJson(Map<String, dynamic> json) => _$MediaRecorderConfigurationFromJson(json); Map<String, dynamic> toJson() => _$MediaRecorderConfigurationToJson(this); }
属性
- storagePath
- 录音文件在本地保存的绝对路径,需精确到文件名及格式。例如:
- Windows:
C:\Users\<user_name>\AppData\Local\Agora\<process_name>\example.mp4
- iOS:
/App Sandbox/Library/Caches/example.mp4
- macOS:
/Library/Logs/example.mp4
- Android:
/storage/emulated/0/Android/data/<package name>/files/example.mp4
注意: 请确保你指定的路径存在并且可写。 - Windows:
- containerFormat
- 录制文件的格式。详见 MediaRecorderContainerFormat。
- streamType
- 录制内容。详见 MediaRecorderStreamType。
- maxDurationMs
- 最大录制时长,单位为毫秒,默认值为 120,000。
- recorderInfoUpdateInterval
- 录制信息更新间隔,单位为毫秒,取值范围为 [1000,10000]。SDK 会根据该值的设置触发 onRecorderInfoUpdated 回调,报告更新后的录制信息。
RecorderInfo
录制文件信息。
class RecorderInfo { final String fileName; final int durationMs; final int fileSize; RecorderInfo(this.fileName, this.durationMs, this.fileSize); factory RecorderInfo.fromJson(Map<String, dynamic> json) => _$RecorderInfoFromJson(json); Map<String, dynamic> toJson() => _$RecorderInfoToJson(this); }
属性
- fileName
- 录制文件的绝对存储路径。
- durationMs
- 录制文件的时长,单位为毫秒。
- fileSize
- 录制文件的大小,单位为字节。
Rect
屏幕共享区域。
class Rect { @JsonKey(includeIfNull: false) @Deprecated('This property is deprecated, pls use x instead.') int? left; @JsonKey(includeIfNull: false) @Deprecated('This property is deprecated, pls use y instead.') int? top; @JsonKey(includeIfNull: false) @Deprecated('This property is deprecated, pls use x + width instead.') int? right; @JsonKey(includeIfNull: false) @Deprecated('This property is deprecated, pls use y + height instead.') int? bottom; int x; int y; int width; int height; Rect({ this.x = 0, this.y = 0, this.width = 0, this.height = 0, this.left, this.top, this.right, this.bottom, }); factory Rect.fromJson(Map<String, dynamic> json) => _$RectFromJson(json); Map<String, dynamic> toJson() => _$RectToJson(this); }
- 弃用:
- 该类已废弃,请使用 updateScreenCaptureRegion 方法更新屏幕共享区域。
属性
- top
- 已废弃。共享区域顶部在纵轴上的坐标。
- left
- 已废弃。共享区域左侧在横轴上的坐标。
- bottom
- 已废弃。共享区域底部在纵轴上的坐标。
- right
- 已废弃。共享区域右侧在横轴上的坐标。
- x
- 左上角的横向偏移。
- y
- 左上角的纵向偏移。
- width
- 目标区域的宽度。
- height
- 目标区域的高度。
Rectangle
目标区域相对于整个屏幕或窗口的位置,如不填,则表示整个屏幕或窗口。
class Rectangle { @JsonKey(includeIfNull: false) int? x; @JsonKey(includeIfNull: false) int? y; @JsonKey(includeIfNull: false) int? width; @JsonKey(includeIfNull: false) int? height; Rectangle({ this.x, this.y, this.width, this.height, }); factory Rectangle.fromJson(Map<String, dynamic> json) => _$RectangleFromJson(json); Map<String, dynamic> toJson() => _$RectangleToJson(this); }
属性
- x
- 左上角的横向偏移。
- y
- 左上角的纵向偏移。
- width
- 目标区域的宽度。
- height
- 目标区域的高度。
RemoteAudioStats
远端用户的音频统计数据。
class RemoteAudioStats { int uid; NetworkQuality quality; int networkTransportDelay; int jitterBufferDelay; int audioLossRate; int numChannels; int receivedSampleRate; int receivedBitrate; int totalFrozenTime; int frozenRate; int totalActiveTime; int publishDuration; ExperienceQualityType qoeQuality; ExperiencePoorReason qualityChangedReason; int mosValue; RemoteAudioStats( this.uid, this.quality, this.networkTransportDelay, this.jitterBufferDelay, this.audioLossRate, this.numChannels, this.receivedSampleRate, this.receivedBitrate, this.totalFrozenTime, this.frozenRate, this.totalActiveTime, this.publishDuration, this.qoeQuality, this.qualityChangedReason, this.mosValue, ); factory RemoteAudioStats.fromJson(Map<String, dynamic> json) => _$RemoteAudioStatsFromJson(json); Map<String, dynamic> toJson() => _$RemoteAudioStatsToJson(this); }
属性
- uid
- 远端用户的用户 ID。
- quality
- 远端用户发送的音频流质量。
- networkTransportDelay
- 音频发送端到接收端的网络延迟(毫秒)。
- jitterBufferDelay
-
音频接收端到网络抖动缓冲的网络延迟(毫秒)。
- audioLossRate
- 统计周期内的远端音频流的丢帧率 (%)。
- numChannels
- 声道数。
- receivedSampleRate
- 统计周期内接收到的远端音频流的采样率。
- receivedBitrate
- 接收到的远端音频流在统计周期内的平均码率(Kbps)。
- totalFrozenTime
- 远端用户在加入频道后发生音频卡顿的累计时长(毫秒)。通话过程中,音频丢帧率达到 4% 即记为一次音频卡顿。
- frozenRate
- 音频卡顿的累计时长占音频总有效时长的百分比 (%)。音频有效时长是指远端用户加入频道后音频未被停止发送或禁用的时长。
- totalActiveTime
-
远端用户在音频通话开始到本次回调之间的有效时长(毫秒)。
有效时长是指去除了远端用户进入静音状态的总时长。
- publishDuration
-
远端音频流的累计发布时长(毫秒)。
- qoeQuality
-
接收远端音频时,本地用户的主观体验质量,详见 ExperienceQualityType。
- qualityChangedReason
-
接收远端音频时,本地用户主观体验质量较差的原因,详见 ExperiencePoorReason。
- mosValue
-
统计周期内,声网实时音频 MOS(平均主观意见分)评估方法对接收到的远端音频流的质量评分。返回值范围为 [0,500]。返回值除以 100 即可得到 MOS 分数,范围为 [0,5] 分,分数越高,音频质量越好。
声网实时音频 MOS 评分对应的主观音质感受如下:MOS分数 音质感受 大于 4 分 音频质量佳,清晰流畅。 3.5 - 4 分 音频质量较好,偶有音质损伤,但依然清晰。 3 - 3.5 分 音频质量一般,偶有卡顿,不是非常流畅,需要一点注意力才能听清。 2.5 - 3 分 音频质量较差,卡顿频繁,需要集中精力才能听清。 2 - 2.5 分 音频质量很差,偶有杂音,部分语义丢失,难以交流。 小于 2 分 音频质量非常差,杂音频现,大量语义丢失,完全无法交流。
RemoteVideoStats
远端视频流的统计信息。
class RemoteVideoStats { int uid; @Deprecated( 'In scenarios where audio and video are synchronized, you can get the video delay data from networkTransportDelay and jitterBufferDelay in RemoteAudioStats.') int delay; int width; int height; int receivedBitrate; int decoderOutputFrameRate; int rendererOutputFrameRate; int packetLossRate; VideoStreamType rxStreamType; int totalFrozenTime; int frozenRate; int totalActiveTime; int publishDuration; RemoteVideoStats( this.uid, this.delay, this.width, this.height, this.receivedBitrate, this.decoderOutputFrameRate, this.rendererOutputFrameRate, this.packetLossRate, this.rxStreamType, this.totalFrozenTime, this.frozenRate, this.totalActiveTime, this.publishDuration, ); factory RemoteVideoStats.fromJson(Map<String, dynamic> json) => _$RemoteVideoStatsFromJson(json); Map<String, dynamic> toJson() => _$RemoteVideoStatsToJson(this); }
属性
- uid
- 用户 ID,指定是哪个用户的视频流。
- delay
-
- 弃用:
- 在有音画同步机制的音视频场景中,你可以参考 RemoteAudioStats 里的 networkTransportDelay 和 jitterBufferDelay 成员的值,了解视频的延迟数据。
延时(毫秒)。
- width
- 视频流宽(像素)。
- height
- 视频流高(像素)。
- receivedBitrate
- (上次统计后)接收到的码率(Kbps)。
- decoderOutputFrameRate
- 远端视频解码器的输出帧率,单位为 fps。
- rendererOutputFrameRate
- 远端视频渲染器的输出帧率,单位为 fps。
- packetLossRate
- 远端视频在使用抗丢包技术之后的丢包率(%)。
- rxStreamType
- 视频流类型,大流或小流。
- totalFrozenTime
- 远端用户在加入频道后发生视频卡顿的累计时长(ms)。通话过程中,视频帧率设置不低于 5 fps 时,连续渲染的两帧视频之间间隔超过 500 ms,则记为一次视频卡顿。
- frozenRate
- 远端用户在加入频道后发生视频卡顿的累计时长占视频总有效时长的百分比 (%)。视频有效时长是指远端用户加入频道后视频未被停止发送或禁用的时长。
- totalActiveTime
-
- 自从
- v3.0.1
视频有效时长(毫秒)。
视频总有效时长是远端用户或主播加入频道后,既没有停止发送视频流,也没有禁用视频模块的通话时长。
- publishDuration
-
- 自从
- v3.1.0
远端视频流的累计发布时长(毫秒)。
RtcEngineContext
声网 SDK 初始化设置。
class RtcEngineContext { String appId; @JsonKey(includeIfNull: false, toJson: _$AreaCodeListToJson) List<AreaCode>? areaCode; @JsonKey(includeIfNull: false) LogConfig? logConfig; RtcEngineContext( this.appId, { this.areaCode, this.logConfig, }); factory RtcEngineContext.fromJson(Map<String, dynamic> json) => _$RtcEngineContextFromJson(json); Map<String, dynamic> toJson() => _$RtcEngineContextToJson(this); static int? _$AreaCodeListToJson(List<AreaCode>? instance) { if (instance == null) return null; var areaCode = 0; for (var element in instance) { areaCode |= AreaCodeConverter(element).value(); } return areaCode; } }
属性
- appId
-
声网为 app 开发项目签发的 App ID。使用同一个 App ID 的用户才能进入同一个频道进行通话或直播。
- areaCode
-
服务器的访问区域。该功能为高级设置,适用于有访问安全限制的场景。支持的区域详见 AreaCode。
指定访问区域后,声网 SDK 会连接指定区域内的声网服务器。
- logConfig
-
声网 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 写入最新的日志。
AgoraImage
图像属性。
class AgoraImage { String url; @JsonKey(includeIfNull: false) int? x; @JsonKey(includeIfNull: false) int? y; int? width; int? height; AgoraImage( this.url, { this.x, this.y, this.width, this.height, }); factory AgoraImage.fromJson(Map<String, dynamic> json) => _$AgoraImageFromJson(json); Map<String, dynamic> toJson() => _$AgoraImageToJson(this); }
用于设置直播视频的水印和背景图片的属性。
属性
- url
- 直播视频上图片的 HTTP/HTTPS 地址。字符长度不得超过 1024 字节。
- x
- 图片在视频画面上的 x 坐标 (pixel),以输出视频画面的左上角为原点。
- y
- 图片在视频画面上的 y 坐标 (pixel),以输出视频画面的左上角为原点。
- width
- 图片在视频画面上的宽度 (pixel)。
- height
- 图片在视频画面上的高度 (pixel)。
RtcStats
通话相关的统计信息。
class RtcStats { int duration; int txBytes; int rxBytes; int txAudioBytes; int txVideoBytes; int rxAudioBytes; int rxVideoBytes; int txKBitRate; int rxKBitRate; int txAudioKBitRate; int rxAudioKBitRate; int txVideoKBitRate; int rxVideoKBitRate; int userCount; int lastmileDelay; int txPacketLossRate; int rxPacketLossRate; double cpuTotalUsage; double cpuAppUsage; int gatewayRtt; double memoryAppUsageRatio; double memoryTotalUsageRatio; int memoryAppUsageInKbytes; RtcStats( this.duration, this.txBytes, this.rxBytes, this.txAudioBytes, this.txVideoBytes, this.rxAudioBytes, this.rxVideoBytes, this.txKBitRate, this.rxKBitRate, this.txAudioKBitRate, this.rxAudioKBitRate, this.txVideoKBitRate, this.rxVideoKBitRate, this.userCount, this.lastmileDelay, this.txPacketLossRate, this.rxPacketLossRate, this.cpuTotalUsage, this.cpuAppUsage, this.gatewayRtt, this.memoryAppUsageRatio, this.memoryTotalUsageRatio, this.memoryAppUsageInKbytes, ); factory RtcStats.fromJson(Map<String, dynamic> json) => _$RtcStatsFromJson(json); Map<String, dynamic> toJson() => _$RtcStatsToJson(this); }
属性
- 本地用户通话时长(秒),累计值。
- 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
- 当前频道内的用户人数。
- cpuAppUsage
- 当前 App 的 CPU 使用率 (%)。
- cpuTotalUsage
-
当前系统的 CPU 使用率 (%)。
注意: leaveChannel 回调中报告的 cpuTotalUsage 恒为 0。 - gatewayRtt
- 客户端到本地路由器的往返时延 (ms)。
- memoryAppUsageRatio
-
当前 App 的内存占比 (%)。
注意: 该值仅作参考。受系统限制可能无法获取。 - memoryTotalUsageRatio
-
当前系统的内存占比 (%)。
注意: 该值仅作参考。受系统限制可能无法获取。 - memoryAppUsageInKbytes
-
当前 App 的内存大小 (KB)。
注意: 该值仅作参考。受系统限制可能无法获取。
ScreenAudioParameters
共享的屏幕流的音频配置。
true
的场景。class ScreenAudioParameters { final int? captureSignalVolume; const ScreenAudioParameters(this.captureSignalVolume); factory ScreenAudioParameters.fromJson(Map<String, dynamic> json) => _$ScreenAudioParametersFromJson(json); Map<String, dynamic> toJson() => _$ScreenAudioParametersToJson(this); }
属性
- captureSignalVolume
-
采集的系统音量。取值范围为 [0,100]。默认值为 100。
ScreenCaptureParameters
屏幕共享的参数配置。
class ScreenCaptureParameters { @JsonKey(includeIfNull: false) VideoDimensions? dimensions; @JsonKey(includeIfNull: false) int? frameRate; @JsonKey(includeIfNull: false) int? bitrate; @JsonKey(includeIfNull: false) bool? captureMouseCursor; @JsonKey(includeIfNull: false) bool? windowFocus; @JsonKey(includeIfNull: false) List<int>? excludeWindowList; ScreenCaptureParameters({ this.dimensions, this.frameRate, this.bitrate, this.captureMouseCursor, this.windowFocus, this.excludeWindowList, }); factory ScreenCaptureParameters.fromJson(Map<String, dynamic> json) => _$ScreenCaptureParametersFromJson(json); Map<String, dynamic> toJson() => _$ScreenCaptureParametersToJson(this); }
属性
- dimensions
-
编码共享视频的最大像素值。
当共享的屏幕分辨率宽高比与该值设置不一致时,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
调用 startScreenCaptureByWindowId 方法共享窗口时,是否将该窗口前置:true
: 前置窗口。false
:(默认)不前置窗口。
- excludeWindowList
-
- 自从
- v3.1.0
待屏蔽窗口的 ID 列表。调用 startScreenCaptureByScreenRect开启屏幕共享时,你可以通过该参数屏蔽指定的窗口。你可以在调用 updateScreenCaptureParameters 更新屏幕共享的配置参数时,通过该参数动态屏蔽指定的窗口。
ScreenCaptureParameters2
屏幕共享的参数配置。
class ScreenCaptureParameters2 { final bool? captureAudio; final ScreenAudioParameters? audioParams; final bool? captureVideo; final ScreenVideoParameters? videoParams; const ScreenCaptureParameters2({ this.captureAudio, this.audioParams, this.captureVideo, this.videoParams, }); factory ScreenCaptureParameters2.fromJson(Map<String, dynamic> json) => _$ScreenCaptureParameters2FromJson(json); Map<String, dynamic> toJson() => _$ScreenCaptureParameters2ToJson(this); }
属性
- captureAudio
-
屏幕共享时是否采集系统音频:
true
: 采集。false
: (默认)不采集。
注意: 对于 Android 平台,受系统限制,采集系统音频仅适用于 Android API 级别为 29 及以上,即 Android 10 及以上。 - audioParams
-
共享的屏幕流的音频配置。详见 ScreenAudioParameters。注意: 该参数仅适用于 captureAudio 为
true
的场景。 - captureVideo
-
屏幕共享时是否采集系统视频:
true
: 采集。false
: (默认)不采集。
注意: 对于 Android 平台,受系统限制,采集屏幕仅适用于 Android API 级别为 21 及以上,即 Android 5 及以上。 - videoParams
-
共享的屏幕流的视频编码配置。详见 ScreenVideoParameters。注意: 该参数仅适用于 captureVideo 为
true
的场景。
ScreenVideoParameters
屏幕共享的参数配置。
class ScreenVideoParameters { final VideoDimensions? dimensions; final int? frameRate; final int? bitrate; final VideoContentHint? contentHint; const ScreenVideoParameters( {this.dimensions, this.frameRate, this.bitrate, this.contentHint}); factory ScreenVideoParameters.fromJson(Map<String, dynamic> json) => _$ScreenVideoParametersFromJson(json); Map<String, dynamic> toJson() => _$ScreenVideoParametersToJson(this); }
属性
- dimensions
-
视频编码的分辨率。默认值为 1280 × 720。推荐取值可参考调参策略。
当共享的屏幕分辨率宽高比与该值设置不一致时,SDK 会按照如下规则调节视频编码分辨率。假设dimensions
设为 1280 × 720:- 当屏幕宽和高的像素值均小于
dimensions
,例如屏幕像素值为 640 × 360,SDK 以 640 × 360 编码。 - 当屏幕宽或高的像素值大于
dimensions
,例如屏幕像素值为 2000 × 1500,SDK 以屏幕像素值的宽高比, 即 4:3,取 dimensions 内最大分辨率进行编码,即 960 × 720。
注:- 屏幕共享流的计费以
dimensions
的值为准:当你未传值时,以 1280 × 720 计费;当你传值时,以你传入的值计费。详细的计费规则请参考实时音视频计费。 - 该值不代表最终视频输出的方向。请查阅 VideoOutputOrientationMode 了解设置视频方向。
- 视频能否达到 720P 的分辨率取决于设备的性能,在性能配备较低的设备上有可能无法实现。如果采用 720P 分辨率而设备性能跟不上,则有可能出现帧率过低的情况。
- 当屏幕宽和高的像素值均小于
- frameRate
-
视频编码帧率 (fps)。默认值为 15。推荐取值可参考调参策略。
- bitrate
-
视频编码码率 (Kbps)。推荐取值可参考调参策略。
- contentHint
-
屏幕共享视频的内容类型。详见详见 VideoContentHint。
ScreenCaptureInfo
屏幕共享信息。
class ScreenCaptureInfo { final String graphicsCardType; final ExcludeWindowError errCode; const ScreenCaptureInfo(this.graphicsCardType, this.errCode); factory ScreenCaptureInfo.fromJson(Map<String, dynamic> json) => _$ScreenCaptureInfoFromJson(json); Map<String, dynamic> toJson() => _$ScreenCaptureInfoToJson(this); }
属性
- graphicsCardType
-
显卡类型,包含显卡的型号信息。
- errCode
-
屏幕共享时,屏蔽窗口的错误码。详见 ExcludeWindowError。
ScreenScenarioType
屏幕共享的场景。在 setScreenCaptureScenario 中设置。
枚举值
- ScreenScenarioDocument
- 1:(默认)文档。该场景下,优先保障共享的画质,并降低了接收端看到共享视频的延时。如果你共享文档、幻灯片、表格,可以设置该场景。
- ScreenScenarioGaming
- 2: 游戏。该场景下,优先保障共享的流畅性。如果你共享游戏,可以设置该场景。
- ScreenScenarioVideo
- 3: 视频。该场景下,优先保障共享的流畅性。如果你共享电影、视频直播,可以设置该场景。
- ScreenScenarioRdc
- 4: 远程控制。该场景下,优先保障共享的画质,并降低了接收端看到共享视频的延时。如果你共享被远程控制的设备桌面,可以设置该场景。
TranscodingUser
参与转码合流的每个主播的设置。
class TranscodingUser { int uid; @JsonKey(includeIfNull: false) int? x; @JsonKey(includeIfNull: false) int? y; @JsonKey(includeIfNull: false) int? width; @JsonKey(includeIfNull: false) int? height; @JsonKey(includeIfNull: false) int? zOrder; @JsonKey(includeIfNull: false) double? alpha; @JsonKey(includeIfNull: false) AudioChannel? audioChannel; TranscodingUser( this.uid, { this.x, this.y, this.width, this.height, this.zOrder, this.alpha, this.audioChannel, }); factory TranscodingUser.fromJson(Map<String, dynamic> json) => _$TranscodingUserFromJson(json); Map<String, dynamic> toJson() => _$TranscodingUserToJson(this); }
属性
- uid
-
主播的用户 ID。
- 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 声道。如果主播上行音频是多声道,声网 服务器会先把多声道混音成单声道。2
: 主播音频在输出音频的 FC 声道。如果主播上行音频是多声道,声网 服务器会先把多声道混音成单声道。3
: 主播音频在输出音频的 FR 声道。如果主播上行音频是多声道,声网 服务器会先把多声道混音成单声道。4
: 主播音频在输出音频的 BL 声道。如果主播上行音频是多声道,声网 服务器会先把多声道混音成单声道。5
: 主播音频在输出音频的 BR 声道。如果主播上行音频是多声道,声网 服务器会先把多声道混音成单声道。0xFF
或取值大于5
: 该主播音频静音,声网 服务器移除该主播的音频。
注意: 取值不为0
时,需要使用特殊的播放器。
UserInfo
用户的信息。
class UserInfo { int uid; String userAccount; UserInfo( this.uid, this.userAccount, ); factory UserInfo.fromJson(Map<String, dynamic> json) => _$UserInfoFromJson(json); Map<String, dynamic> toJson() => _$UserInfoToJson(this); }
- 自从
- v2.8.0
属性
- uid
- 用户 ID。
- userAccount
- 用户 Account。
VideoDimensions
视频尺寸。
class VideoDimensions { @JsonKey(includeIfNull: false) int? width; @JsonKey(includeIfNull: false) int? height; VideoDimensions({ this.width, this.height, }); factory VideoDimensions.fromJson(Map<String, dynamic> json) => _$VideoDimensionsFromJson(json); Map<String, dynamic> toJson() => _$VideoDimensionsToJson(this); }
属性
- width
-
视频宽度,单位为像素。
- height
- 视频高度,单位为像素。
VideoEncoderConfiguration
视频编码器的配置。
class VideoEncoderConfiguration { @JsonKey(includeIfNull: false) VideoDimensions? dimensions; @JsonKey(includeIfNull: false) VideoFrameRate? frameRate; @JsonKey(includeIfNull: false) VideoFrameRate? minFrameRate; @JsonKey(includeIfNull: false) int? bitrate; @JsonKey(includeIfNull: false) int? minBitrate; @JsonKey(includeIfNull: false) VideoOutputOrientationMode? orientationMode; @JsonKey(includeIfNull: false) DegradationPreference? degradationPrefer; @JsonKey(includeIfNull: false) VideoMirrorMode? mirrorMode; VideoEncoderConfiguration({ this.dimensions, this.frameRate, this.minFrameRate, this.bitrate, this.minBitrate, this.orientationMode, this.degradationPrefer, this.mirrorMode, }); factory VideoEncoderConfiguration.fromJson(Map<String, dynamic> json) => _$VideoEncoderConfigurationFromJson(json); Map<String, dynamic> toJson() => _$VideoEncoderConfigurationToJson(this); }
属性
- dimensions
- frameRate
-
视频编码的帧率(fps),默认值为 15。详见 VideoFrameRate。
- bitrate
-
视频编码码率,单位为 Kbps。
你可以根据场景需要参照下表手动设置你想要的码率。若设置的视频码率超出合理范围,SDK 会自动按照合理区间处理码率。你也可以直接选择如下任意一种模式进行设置:
- Standard : (推荐) 标准码率模式。该模式下,视频在直播场景下的码率是通信场景的两倍。
- Compatible: 适配码率模式。该模式下,视频在通信和直播场景下的码率一致。直播时如果选择该模式,视频帧率可能会低于设置的值。
声网在通信和直播场景下采用不同的编码方式,以提升不同场景下的用户体验。通信场景保证流畅,而直播场景则更注重画面质量,因此直播场景对码率的需求大于通信场景。所以声网推荐将该参数设置为 Standard。你也可以直接将直播场景的码率值设为通信场景码率值的 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
- 视频编码的方向模式,详见 VideoOutputOrientationMode。
- degradationPreference
- 带宽受限时,视频编码降级偏好。详见 DegradationPreference 。
- mirrorMode
-
注意: 默认关闭镜像模式。
VideoDenoiserOptions
视频降噪选项。
class VideoDenoiserOptions { final VideoDenoiserMode mode; final VideoDenoiserLevel level; const VideoDenoiserOptions( {this.mode = VideoDenoiserMode.Auto, this.level = VideoDenoiserLevel.HighQuality}); factory VideoDenoiserOptions.fromJson(Map<String, dynamic> json) => _$VideoDenoiserOptionsFromJson(json); Map<String, dynamic> toJson() => _$VideoDenoiserOptionsToJson(this); }
属性
- level
-
视频降噪等级。详见 VideoDenoiserLevel。
- mode
-
视频降噪模式。详见 VideoDenoiserMode。
VirtualBackgroundSource
自定义的背景。
class VirtualBackgroundSource { @JsonKey(includeIfNull: false) VirtualBackgroundSourceType? backgroundSourceType; @JsonKey(includeIfNull: false) int? color; @JsonKey(includeIfNull: false) String? source; @JsonKey(name: 'blur_degree') VirtualBackgroundBlurDegree blurDegree; VirtualBackgroundSource({ this.backgroundSourceType, this.color, this.source, this.blurDegree = VirtualBackgroundBlurDegree.High, }); factory VirtualBackgroundSource.fromJson(Map<String, dynamic> json) => _$VirtualBackgroundSourceFromJson(json); Map<String, dynamic> toJson() => _$VirtualBackgroundSourceToJson(this); }
属性
- backgroundSourceType
- 自定义的背景图类型。详见 BACKGROUND_SOURCE_TYPE。
- color
- 自定义的背景图颜色。格式为 RGB 定义下的十六进制整数,不要带 # 号,如 0xFFB6C1 表示浅粉色。 默认值为 0xFFFFFF,表示白色。 取值范围为 [0x000000,0xffffff]。如果取值非法,SDK 会用白色背景图替换原背景图。
注意: 该参数仅在自定义背景图类型为 BACKGROUND_COLOR 时生效。
- source
- 自定义背景图的本地绝对路径。支持 PNG 和 JPG 格式。如果路径无效,SDK 会用白色背景图替换原背景图。
注意: 该参数仅在自定义背景图类型为 BACKGROUND_IMG 时生效。
- blurDegree
- 自定义背景图的模糊程度。详见 VirtualBackgroundBlurDegree。
注意: 该参数仅在自定义背景图类型为 BACKGROUND_BLUR 时生效。
WatermarkOptions
水印图片的设置。
class WatermarkOptions { @JsonKey(includeIfNull: false) bool? visibleInPreview; @JsonKey(includeIfNull: false) Rectangle? positionInLandscapeMode; @JsonKey(includeIfNull: false) Rectangle? positionInPortraitMode; WatermarkOptions({ this.visibleInPreview, this.positionInLandscapeMode, this.positionInPortraitMode, }); factory WatermarkOptions.fromJson(Map<String, dynamic> json) => _$WatermarkOptionsFromJson(json); Map<String, dynamic> toJson() => _$WatermarkOptionsToJson(this); }
属性
- visibleInPreview
-
水印图片在本地视频预览中是否可见:
true
:(默认) 水印图片在本地视频预览中可见;false
:水印图片在本地视频预览中不可见。
- positionInLandscapeMode
-
横屏模式下,显示水印图片的区域。
- positionInPortraitMode
-
竖屏模式下,显示水印图片的区域。
WlAccStats
Wi-Fi 加速效果。
class WlAccStats { final int e2eDelayPercent; final int frozenRatioPercent; final int lossRatePercent; const WlAccStats( this.e2eDelayPercent, this.frozenRatioPercent, this.lossRatePercent); factory WlAccStats.fromJson(Map<String, dynamic> json) => _$WlAccStatsFromJson(json); Map<String, dynamic> toJson() => _$WlAccStatsToJson(this); }
属性
- e2eDelayPercent
- 端到端延时下降百分比。
- frozenRatioPercent
- 音视频卡顿率下降百分比。
- lossRatePercent
- 丢包率下降百分比。
RhythmPlayerConfig
虚拟节拍器配置。
class RhythmPlayerConfig { @JsonKey(includeIfNull: false) int? beatsPerMeasure; @JsonKey(includeIfNull: false) int? beatsPerMinute; @JsonKey(includeIfNull: false) bool? publish; RhythmPlayerConfig({ this.beatsPerMeasure, this.beatsPerMinute, this.publish, }); factory RhythmPlayerConfig.fromJson(Map<String, dynamic> json) => _$RhythmPlayerConfigFromJson(json); Map<String, dynamic> toJson() => _$RhythmPlayerConfigToJson(this); }
属性
- beatsPerMeasure
- 每小节的拍数,取值范围为 [1,9]。默认值为 4,即每小节包含 1 个强拍和 3 个弱拍。
- beatsPerMinute
- 节拍速度(拍/分钟),取值范围为 [60,360]。默认值为 60,即 1 分钟有 60 拍。
- publish
- 是否将节拍器的声音发布至远端:
true
: (默认)发布。本地用户和远端用户都能听到节拍器。false
: 不发布。只有本地用户能听到节拍器。
AudioRecordingConfiguration
客户端录音配置。
class AudioRecordingConfiguration { String filePath; @JsonKey(includeIfNull: false) AudioRecordingQuality? recordingQuality; @JsonKey(includeIfNull: false) AudioRecordingPosition? recordingPosition; @JsonKey(includeIfNull: false) AudioSampleRateType? recordingSampleRate; AudioRecordingConfiguration( this.filePath, { this.recordingQuality, this.recordingPosition, this.recordingSampleRate, }); factory AudioRecordingConfiguration.fromJson(Map<String, dynamic> json) => _$AudioRecordingConfigurationFromJson(json); Map<String, dynamic> toJson() => _$AudioRecordingConfigurationToJson(this); }
属性
- filePath
-
录音文件在本地保存的绝对路径,需精确到文件名及格式。例如:
C:\music\audio.aac
。注意: 请确保你指定的路径存在并且可写。 - recordingChannel
-
录制的音频声道。支持如下取值:
- 1: (默认)单声道。
- 2: 双声道。
注意: 实际录制的音频声道与你采集的音频声道有关:如果采集的音频为单声道, recordingChannel 为 2,则录制的音频为经过单声道数据拷贝后的双声道数据,而不是立体声。如果采集的音频为双声道, recordingChannel 为 1,则录制的音频为经过双声道数据混合后的单声道数据。此外,集成方案也会影响最终录制的音频声道。因此,如果你希望录制立体声,请联系技术支持协助。 - recordingQuality
-
录音音质。详见 AudioRecordingQuality。
注意: 该参数仅适用于 AAC 文件。 - recordingPosition
- 录音内容。详见 AudioRecordingPosition。
- recordingSampleRate
- 录音采样率 (Hz)。
- 16000
- (默认)32000
- 44100
- 48000
注意: 如果把该参数设为 44100 或 48000,为保证录音效果,声网推荐录制 WAV 文件 或 recordingQuality 为 Medium 或 High 的 AAV 文件。