CreateCustomAudioTrack
Creates a custom audio track.
public abstract uint CreateCustomAudioTrack(AUDIO_TRACK_TYPE trackType, AudioTrackConfig config);
Details
To publish a custom audio source to multiple channels, see the following steps:
- Call this method to create a custom audio track and get the audio track ID.
- In ChannelMediaOptions of each channel, set publishCustomAduioTrackId to the audio track ID that you want to publish, and set publishCustomAudioTrack to
true
. - If you call PushAudioFrame, and specify trackId as the audio track ID set in step 2, you can publish the corresponding custom audio source in multiple channels.
Parameters
- trackType
- The type of the custom audio track. See AUDIO_TRACK_TYPE.Attention: If AUDIO_TRACK_DIRECT is specified for this parameter, you must set
publishMicrophoneTrack
tofalse
in ChannelMediaOptions when calling JoinChannel [2/2] to join the channel; otherwise, joining the channel fails and returns the error code -2. - config
- The configuration of the custom audio track. See AudioTrackConfig.
Returns
- If the method call is successful, the audio track ID is returned as the unique identifier of the audio track.
- If the method call fails, a negative value is returned.