Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1e01ca5

Browse files
author
Xia Ning
committed
support cloud proxy settings
1 parent 5aa28f6 commit 1e01ca5

File tree

22 files changed

+138
-24
lines changed

22 files changed

+138
-24
lines changed

macOS/APIExample/Base.lproj/Settings.storyboard

Lines changed: 54 additions & 23 deletions
Large diffs are not rendered by default.

macOS/APIExample/Commons/Configs.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ struct Layout {
3030
}
3131

3232
class Configs {
33+
static var defaultProxySettingIdx: Int = 1
3334
static var defaultResolutionIdx: Int = 2
3435
static var Resolutions:[Resolution] = [
3536
Resolution(width: 320, height: 240),
@@ -42,6 +43,10 @@ class Configs {
4243
15,
4344
30
4445
]
46+
static var Proxy:[Bool] = [
47+
true,
48+
false
49+
]
4550
static var VideoContentHints:[AgoraVideoContentHint] = [
4651
AgoraVideoContentHint.none,
4752
AgoraVideoContentHint.motion,

macOS/APIExample/Commons/GlobalSettings.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,9 @@ class GlobalSettings {
4646
SettingItemOption(idx: $0.offset, label: "\($0.element)fps", value: $0.offset)
4747
}
4848
)
49+
let proxySetting: SettingItem<Int> = SettingItem(
50+
selected: Configs.defaultProxySettingIdx,
51+
options: Configs.Proxy.enumerated().map{
52+
SettingItemOption(idx: $0.offset, label: String($0.element), value: $0.offset)
53+
})
4954
}

macOS/APIExample/Examples/Advanced/AudioMixing/AudioMixing.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,9 @@ class AudioMixing: BaseViewController {
379379
return
380380
}
381381
agoraKit.setDevice(.audioRecording, deviceId: micId)
382+
// set proxy configuration
383+
let proxySetting = GlobalSettings.shared.proxySetting.selectedOption().value
384+
agoraKit.setCloudProxy(AgoraCloudProxyType.init(rawValue: UInt(proxySetting)) ?? .noneProxy)
382385
// disable video module in audio scene
383386
agoraKit.disableVideo()
384387
agoraKit.setAudioProfile(profile, scenario: scenario)

macOS/APIExample/Examples/Advanced/ChannelMediaRelay/ChannelMediaRelay.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ class ChannelMediaRelay: BaseViewController {
131131
// set myself as broadcaster to stream video/audio
132132
agoraKit.setClientRole(.broadcaster)
133133

134+
// set proxy configuration
135+
let proxySetting = GlobalSettings.shared.proxySetting.selectedOption().value
136+
agoraKit.setCloudProxy(AgoraCloudProxyType.init(rawValue: UInt(proxySetting)) ?? .noneProxy)
137+
134138
// set up local video to render your local camera preview
135139
let localVideo = videos[0]
136140
let videoCanvas = AgoraRtcVideoCanvas()

macOS/APIExample/Examples/Advanced/CreateDataStream/CreateDataStream.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,10 @@ class CreateDataStream: BaseViewController {
159159
// set myself as broadcaster to stream video/audio
160160
agoraKit.setClientRole(.broadcaster)
161161

162+
// set proxy configuration
163+
let proxySetting = GlobalSettings.shared.proxySetting.selectedOption().value
164+
agoraKit.setCloudProxy(AgoraCloudProxyType.init(rawValue: UInt(proxySetting)) ?? .noneProxy)
165+
162166
// set up local video to render your local camera preview
163167
let localVideo = videos[0]
164168
let videoCanvas = AgoraRtcVideoCanvas()

macOS/APIExample/Examples/Advanced/CustomAudioRender/CustomAudioRender.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ class CustomAudioRender: BaseViewController {
155155
// disable video module in audio scene
156156
agoraKit.disableVideo()
157157

158+
// set proxy configuration
159+
let proxySetting = GlobalSettings.shared.proxySetting.selectedOption().value
160+
agoraKit.setCloudProxy(AgoraCloudProxyType.init(rawValue: UInt(proxySetting)) ?? .noneProxy)
161+
158162
// set live broadcaster mode
159163
agoraKit.setChannelProfile(.liveBroadcasting)
160164
// set myself as broadcaster to stream audio
@@ -164,7 +168,8 @@ class CustomAudioRender: BaseViewController {
164168
exAudio.setupExternalAudio(withAgoraKit: agoraKit, sampleRate: UInt32(sampleRate), channels: UInt32(audioChannel), audioCRMode: .sdkCaptureExterRender, ioType: .remoteIO)
165169
// important!! this example is using onPlaybackAudioFrame to do custom rendering
166170
// by default the audio output will still be processed by SDK hence below api call is mandatory to disable that behavior
167-
agoraKit.setParameters("{\"che.audio.external_render\": false}")
171+
agoraKit.setParameters("{\"che.audio.external_render\": true}")
172+
agoraKit.setParameters("{\"che.audio.keep.audiosession\": true}")
168173

169174
// start joining channel
170175
// 1. Users can only see each other after they join the

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ class CustomAudioSource: BaseViewController {
154154
// disable video module in audio scene
155155
agoraKit.disableVideo()
156156

157+
// set proxy configuration
158+
let proxySetting = GlobalSettings.shared.proxySetting.selectedOption().value
159+
agoraKit.setCloudProxy(AgoraCloudProxyType.init(rawValue: UInt(proxySetting)) ?? .noneProxy)
160+
157161
// set live broadcaster mode
158162
agoraKit.setChannelProfile(.liveBroadcasting)
159163
// set myself as broadcaster to stream audio

macOS/APIExample/Examples/Advanced/CustomVideoRender/CustomVideoRender.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ class CustomVideoRender: BaseViewController {
192192
// set myself as broadcaster to stream video/audio
193193
agoraKit.setClientRole(.broadcaster)
194194

195+
// set proxy configuration
196+
let proxySetting = GlobalSettings.shared.proxySetting.selectedOption().value
197+
agoraKit.setCloudProxy(AgoraCloudProxyType.init(rawValue: UInt(proxySetting)) ?? .noneProxy)
198+
195199
// setup my own camera as custom video source
196200
agoraKit.setVideoSource(customCamera)
197201
// enable video module and set up video encoding configs

macOS/APIExample/Examples/Advanced/CustomVideoSourceMediaIO/CustomVideoSourceMediaIO.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,9 @@ class CustomVideoSourceMediaIO: BaseViewController {
211211
}
212212
// set live broadcaster mode
213213
agoraKit.setChannelProfile(.liveBroadcasting)
214+
// set proxy configuration
215+
let proxySetting = GlobalSettings.shared.proxySetting.selectedOption().value
216+
agoraKit.setCloudProxy(AgoraCloudProxyType.init(rawValue: UInt(proxySetting)) ?? .noneProxy)
214217
// set myself as broadcaster to stream video/audio
215218
agoraKit.setClientRole(.broadcaster)
216219
// setup my own camera as custom video source

0 commit comments

Comments
 (0)