Skip to content

Commit 408e5df

Browse files
author
zhaoyongqiang
committed
音频自采集添加publishMicrophoneTrack
1 parent 626fcb0 commit 408e5df

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

iOS/APIExample/Examples/Advanced/CustomPcmAudioSource/CustomPcmAudioSource.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ class CustomPcmAudioSourceMain: BaseViewController {
9292
// the token has to match the ones used for channel join
9393
let option = AgoraRtcChannelMediaOptions()
9494
option.publishCameraTrack = .of(false)
95+
option.publishMicrophoneTrack = .of(true)
9596
option.publishCustomAudioTrack = .of(true)
9697
option.clientRoleType = .of((Int32)(AgoraClientRole.broadcaster.rawValue))
9798
let result = agoraKit.joinChannel(byToken: KeyCenter.Token, channelId: channelName, uid: 0, mediaOptions: option)
@@ -121,10 +122,10 @@ class CustomPcmAudioSourceMain: BaseViewController {
121122
// if isOn, update config to publish mic audio
122123
let option = AgoraRtcChannelMediaOptions()
123124
option.publishCameraTrack = .of(false)
124-
option.publishCustomAudioTrack = .of(sender.isOn)
125+
option.publishMicrophoneTrack = .of(sender.isOn)
126+
option.publishCustomAudioTrack = .of(pushPcmSwitch.isOn)
125127
option.clientRoleType = .of((Int32)(sender.isOn ? AgoraClientRole.broadcaster.rawValue : AgoraClientRole.audience.rawValue))
126128
agoraKit.updateChannel(with: option)
127-
// _ = sender.isOn ? agoraKit.enableAudio() : agoraKit.disableAudio()
128129
}
129130

130131
@IBAction func pushPCM(_ sender: UISwitch) {

macOS/APIExample/Examples/Advanced/CustomAudioSource/CustomAudioSource.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ class CustomAudioSource: BaseViewController {
202202
isProcessing = true
203203

204204
let option = AgoraRtcChannelMediaOptions()
205+
option.publishMicrophoneTrack = .of(true)
205206
option.publishCustomAudioTrack = .of(true)
206207
option.publishCameraTrack = .of(false)
207208
let result = agoraKit.joinChannel(byToken: KeyCenter.Token, channelId: channel, uid: 0, mediaOptions: option)

0 commit comments

Comments
 (0)