Skip to content

Commit bb04818

Browse files
author
HeZhengQing
committed
[FIX] swiftUI bug fix
1 parent 2be8163 commit bb04818

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

iOS/APIExample-SwiftUI/APIExample-SwiftUI/Examples/Advanced/Simulcast/Simulcast.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ struct Simulcast: View {
9898
default:
9999
return
100100
}
101+
ToastView.show(text: "Maxmum 3 layers can be selected".localized)
101102
return
102103
}
103104
agoraKit.updateSimulcastConfig(layer: layer, enable: isEnabled)

iOS/APIExample-SwiftUI/APIExample-SwiftUI/Examples/Advanced/Simulcast/SimulcastRTC.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ class SimulcastRTC: NSObject, ObservableObject {
6767
// when joining channel. The channel name and uid used to calculate
6868
// the token has to match the ones used for channel join
6969
let option = AgoraRtcChannelMediaOptions()
70-
option.publishCameraTrack = GlobalSettings.shared.getUserRole() == .broadcaster
71-
option.publishMicrophoneTrack = GlobalSettings.shared.getUserRole() == .broadcaster
72-
option.clientRoleType = GlobalSettings.shared.getUserRole()
70+
option.publishCameraTrack = (roleIndex == 0)
71+
option.publishMicrophoneTrack = (roleIndex == 0)
72+
option.clientRoleType = (roleIndex == 0) ? .broadcaster : .audience
7373
NetworkManager.shared.generateToken(channelName: channelName, success: { token in
7474
let result = self.agoraKit.joinChannel(byToken: token, channelId: channelName, uid: 0, mediaOptions: option)
7575
if result != 0 {
@@ -123,7 +123,7 @@ class SimulcastRTC: NSObject, ObservableObject {
123123
simulcastConfig.configs[layer4_index].dimensions.width = 480
124124
simulcastConfig.configs[layer4_index].dimensions.height = 270
125125
simulcastConfig.configs[layer4_index].framerate = 15
126-
simulcastConfig.configs[layer4_index].enable = true
126+
simulcastConfig.configs[layer4_index].enable = false
127127

128128
let ret = agoraKit.setSimulcastConfig(simulcastConfig)
129129
LogUtils.log(message: "setSimulcastConfig: \(String(describing: ret))", level: .info)

iOS/APIExample-SwiftUI/APIExample-SwiftUI/Resources/Localizable.strings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,3 +274,4 @@
274274
"Voice Conversion" = "Voice Conversion";
275275
"Voice Formant" = "Voice Formant";
276276
"Set Layers Config(Maximum 3)" = "Set Layers Config(Maximum 3)";
277+
"Maxmum 3 layers can be selected" = "Maxmum 3 layers can be selected";

0 commit comments

Comments
 (0)