Skip to content

Instantly share code, notes, and snippets.

@digitallysavvy
Last active August 27, 2021 21:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save digitallysavvy/4639cc17f0a2a5fbaa7c6f3eeeeaa0ae to your computer and use it in GitHub Desktop.
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
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