@@ -256,28 +256,29 @@ class StreamEncryption: BaseViewController {
256256 videoCanvas. view = localVideo. videocanvas
257257 videoCanvas. renderMode = . hidden
258258 agoraKit. setupLocalVideo ( videoCanvas)
259-
260- // start joining channel
261- // 1. Users can only see each other after they join the
262- // same channel successfully using the same app id.
263- // 2. If app certificate is turned on at dashboard, token is needed
264- // when joining channel. The channel name and uid used to calculate
265- // the token has to match the ones used for channel join
266- isProcessing = true
267- let option = AgoraRtcChannelMediaOptions ( )
268- let result = agoraKit. joinChannel ( byToken: KeyCenter . Token, channelId: channel, info: nil , uid: 0 , options: option)
269- if result != 0 {
270- isProcessing = false
271- // Usually happens with invalid parameters
272- // Error code description can be found at:
273- // en: https://docs.agora.io/en/Voice/API%20Reference/oc/Constants/AgoraErrorCode.html
274- // cn: https://docs.agora.io/cn/Voice/API%20Reference/oc/Constants/AgoraErrorCode.html
275- self . showAlert ( title: " Error " , message: " joinChannel call failed: \( result) , please check your params " )
276- }
259+
277260 } else {
278261 // your own custom algorithm encryption
279262 AgoraCustomEncryption . registerPacketProcessing ( agoraKit)
280263 }
264+
265+ // start joining channel
266+ // 1. Users can only see each other after they join the
267+ // same channel successfully using the same app id.
268+ // 2. If app certificate is turned on at dashboard, token is needed
269+ // when joining channel. The channel name and uid used to calculate
270+ // the token has to match the ones used for channel join
271+ isProcessing = true
272+ let option = AgoraRtcChannelMediaOptions ( )
273+ let result = agoraKit. joinChannel ( byToken: KeyCenter . Token, channelId: channel, info: nil , uid: 0 , options: option)
274+ if result != 0 {
275+ isProcessing = false
276+ // Usually happens with invalid parameters
277+ // Error code description can be found at:
278+ // en: https://docs.agora.io/en/Voice/API%20Reference/oc/Constants/AgoraErrorCode.html
279+ // cn: https://docs.agora.io/cn/Voice/API%20Reference/oc/Constants/AgoraErrorCode.html
280+ self . showAlert ( title: " Error " , message: " joinChannel call failed: \( result) , please check your params " )
281+ }
281282 } else {
282283 isProcessing = true
283284 agoraKit. disableVideo ( )
0 commit comments