@@ -61,7 +61,10 @@ class JoinMultipleChannel: BaseViewController {
6161 mediaOptions. publishCameraTrack = . of( true )
6262 mediaOptions. channelProfile = . of( ( Int32) ( AgoraChannelProfile . liveBroadcasting. rawValue) )
6363 mediaOptions. clientRoleType = . of( ( Int32) ( AgoraClientRole . broadcaster. rawValue) )
64- let result = agoraKit. joinChannelEx ( byToken: nil , channelId: channelName1, uid: 0 , connectionId: connectionIdPointer1, delegate: channel1, mediaOptions: mediaOptions)
64+ let connection1 = AgoraRtcConnection ( )
65+ connection1. channelId = channelName1
66+ connection1. localUid = 0
67+ let result = agoraKit. joinChannelEx ( byToken: nil , connection: connection1, delegate: channel1, mediaOptions: mediaOptions)
6568 channel1. connectionId = UInt32 ( connectionIdPointer1. pointee)
6669 connectionId1 = UInt32 ( connectionIdPointer1. pointee)
6770 channel1. connecitonDelegate = self
@@ -77,7 +80,9 @@ class JoinMultipleChannel: BaseViewController {
7780 isJoined = true
7881 }
7982 } else {
80- agoraKit. leaveChannelEx ( channelName1, connectionId: UInt ( connectionId1 ?? 0 ) , leaveChannelBlock: nil )
83+ let channel1 = AgoraRtcConnection ( )
84+ channel1. channelId = channelName1
85+ agoraKit. leaveChannelEx ( channel1, leaveChannelBlock: nil )
8186 isJoined = false
8287 }
8388 }
@@ -116,7 +121,10 @@ class JoinMultipleChannel: BaseViewController {
116121 mediaOptions. publishCameraTrack = . of( true )
117122 mediaOptions. channelProfile = . of( ( Int32) ( AgoraChannelProfile . liveBroadcasting. rawValue) )
118123 mediaOptions. clientRoleType = . of( ( Int32) ( AgoraClientRole . broadcaster. rawValue) )
119- let result = agoraKit. joinChannelEx ( byToken: nil , channelId: channelName2, uid: 0 , connectionId: connectionIdPointer2, delegate: channel2, mediaOptions: mediaOptions)
124+ let connection2 = AgoraRtcConnection ( )
125+ connection2. channelId = channelName2
126+ connection2. localUid = 0
127+ let result = agoraKit. joinChannelEx ( byToken: nil , connection: connection2, delegate: channel1, mediaOptions: mediaOptions)
120128 channel2. connectionId = UInt32 ( connectionIdPointer2. pointee)
121129 connectionId2 = UInt32 ( connectionIdPointer2. pointee)
122130 channel2. connecitonDelegate = self
@@ -132,7 +140,9 @@ class JoinMultipleChannel: BaseViewController {
132140 isJoined2 = true
133141 }
134142 } else {
135- agoraKit. leaveChannelEx ( channelName2, connectionId: UInt ( connectionId2 ?? 0 ) , leaveChannelBlock: nil )
143+ let channel2 = AgoraRtcConnection ( )
144+ channel2. channelId = channelName2
145+ agoraKit. leaveChannelEx ( channel2, leaveChannelBlock: nil )
136146 isJoined2 = false
137147 }
138148 }
@@ -258,7 +268,8 @@ extension JoinMultipleChannel :JoinMultiChannelMainConnectionProtocol {
258268 // the view to be binded
259269 videoCanvas. view = connectionId == connectionId1 ? videos2 [ 0 ] . videocanvas : videos2 [ 1 ] . videocanvas
260270 videoCanvas. renderMode = . hidden
261- agoraKit. setupRemoteVideoEx ( videoCanvas, connectionId: UInt ( connectionId) )
271+ let connection = AgoraRtcConnection ( )
272+ agoraKit. setupRemoteVideoEx ( videoCanvas, connection: connection)
262273 }
263274
264275 func rtcEngine( _ engine: AgoraRtcEngineKit , connectionId: UInt32 , didOfflineOfUid uid: UInt , reason: AgoraUserOfflineReason ) {
@@ -272,7 +283,8 @@ extension JoinMultipleChannel :JoinMultiChannelMainConnectionProtocol {
272283 // the view to be binded
273284 videoCanvas. view = nil
274285 videoCanvas. renderMode = . hidden
275- agoraKit. setupRemoteVideoEx ( videoCanvas, connectionId: UInt ( connectionId) )
286+ let connection = AgoraRtcConnection ( )
287+ agoraKit. setupRemoteVideoEx ( videoCanvas, connection: connection)
276288 }
277289
278290
0 commit comments