Last active
August 27, 2021 21:13
-
-
Save digitallysavvy/4639cc17f0a2a5fbaa7c6f3eeeeaa0ae to your computer and use it in GitHub Desktop.
Snippet to join the channel within the viewDidLoad for the ARSupportBroadcasterViewController and ARSupportAudienceViewController
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func joinChannel() { | |
// Set audio route to speaker | |
self.agoraKit.setDefaultAudioRouteToSpeakerphone(true) | |
// get the token - returns nil if no value is set | |
let token = getValue(withKey: "token", within: "keys") | |
// Join the channel | |
self.agoraKit.joinChannel(byToken: token, channelId: self.channelName, info: nil, uid: 0) { (channel, uid, elapsed) in | |
if self.debug { | |
print("Successfully joined: \(channel), with \(uid): \(elapsed) secongs ago") | |
} | |
} | |
UIApplication.shared.isIdleTimerDisabled = true // Disable idle timmer | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment