createCustomAudioTrack abstract method
Future<int>
createCustomAudioTrack({
- required AudioTrackType trackType,
- required AudioTrackConfig config,
创建一个自定义音频采集轨道。
如需在频道中发布自定义采集音频,可参考以下步骤: 调用该方法创建音频轨道并获得音频轨道 ID。 调用 joinChannel 加入频道时,将 ChannelMediaOptions 中的 publishCustomAudioTrackId 设置为你想要发布的音频轨道 ID,并将 publishCustomAudioTrack 设置为 true 。 调用 pushAudioFrame 将 trackId 指定为步骤 2 中指定的音频轨道 ID,即可实现在频道内发布对应的自定义音频源。 该方法需要在加入频道前调用。
trackType自定义音频轨道类型。详见 AudioTrackType 。 如指定 audioTrackDirect ,则必须在调用 joinChannel 加入频道时,将 ChannelMediaOptions 中的 publishMicrophoneTrack 设为 false ,否则加入频道失败并返回错误码 -2。config自定义音频轨道配置。详见 AudioTrackConfig 。
Returns 方法调用成功,返回音频轨道 ID 作为该音频轨道的唯一标识。 方法调用失败,返回 0xffffffff。详见错误码了解详情和解决建议。
Implementation
Future<int> createCustomAudioTrack(
{required AudioTrackType trackType, required AudioTrackConfig config});