Skip to content

Commit 9977bc0

Browse files
committed
fix: custom audio render audio scenario changed
1 parent bdbceba commit 9977bc0

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

iOS/APIExample-Audio/APIExample-Audio/Examples/Advanced/CustomAudioRender/CustomAudioRender.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ class CustomAudioRenderMain: BaseViewController {
7171
// Set audio route to speaker
7272
agoraKit.setDefaultAudioRouteToSpeakerphone(true)
7373

74+
// It is necessary to use publishMicrophoneTrack(true) and pullPlaybackAudio should utilize gameStreaming.
75+
agoraKit.setAudioScenario(.gameStreaming)
76+
7477
// important!! this example is using onPlaybackAudioFrame to do custom rendering
7578
// by default the audio output will still be processed by SDK hence below api call is mandatory to disable that behavior
7679
// agoraKit.adjustPlaybackSignalVolume(0)
@@ -88,7 +91,7 @@ class CustomAudioRenderMain: BaseViewController {
8891
// the token has to match the ones used for channel join
8992
let option = AgoraRtcChannelMediaOptions()
9093
option.publishCameraTrack = false
91-
option.publishMicrophoneTrack = false
94+
option.publishMicrophoneTrack = true
9295
option.autoSubscribeAudio = true
9396
option.autoSubscribeVideo = false
9497
option.channelProfile = .liveBroadcasting

iOS/APIExample/APIExample/Examples/Advanced/CustomAudioRender/CustomAudioRender.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ class CustomAudioRenderMain: BaseViewController {
7171
agoraKit.enableAudio()
7272
// Set audio route to speaker
7373
agoraKit.setDefaultAudioRouteToSpeakerphone(true)
74+
// It is necessary to use publishMicrophoneTrack(true) and pullPlaybackAudio should utilize gameStreaming.
75+
agoraKit.setAudioScenario(.gameStreaming)
7476

7577
// start joining channel
7678
// 1. Users can only see each other after they join the
@@ -80,7 +82,7 @@ class CustomAudioRenderMain: BaseViewController {
8082
// the token has to match the ones used for channel join
8183
let option = AgoraRtcChannelMediaOptions()
8284
option.publishCameraTrack = false
83-
option.publishMicrophoneTrack = false
85+
option.publishMicrophoneTrack = true
8486
option.autoSubscribeAudio = true
8587
option.autoSubscribeVideo = false
8688
option.channelProfile = .liveBroadcasting

0 commit comments

Comments
 (0)