Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
An example lobby view where ViewController that inherits from AgoraLobbyVC and adds custom images to the ARAudience and ARBroadcaster views.
import UIKit
import AgoraARKit
class ViewController: AgoraLobbyVC {
override func loadView() {
super.loadView()
AgoraARKit.agoraAppId = ""
// set the banner image within the initial view
if let agoraLogo = UIImage(named: "watson_live_banner") {
self.bannerImage = agoraLogo
}
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
// MARK: Button Actions
@IBAction override func joinSession() {
if let channelName = self.userInput.text {
if channelName != "" {
let arAudienceVC = ARAudience()
if let exitBtnImage = UIImage(named: "exit") {
arAudienceVC.backBtnImage = exitBtnImage
}
arAudienceVC.channelName = channelName
arAudienceVC.modalPresentationStyle = .fullScreen
self.present(arAudienceVC, animated: true, completion: nil)
} else {
// TODO: add visible msg to user
print("unable to join a broadcast without a channel name")
}
}
}
@IBAction override func createSession() {
if let channelName = self.userInput.text {
if channelName != "" {
let arBroadcastVC = ARBroadcaster()
if let exitBtnImage = UIImage(named: "exit") {
arBroadcastVC.backBtnImage = exitBtnImage
}
if let micBtnImage = UIImage(named: "mic"),
let muteBtnImage = UIImage(named: "mute") {
arBroadcastVC.micBtnImage = micBtnImage
arBroadcastVC.muteBtnImage = muteBtnImage
}
arBroadcastVC.channelName = channelName
arBroadcastVC.modalPresentationStyle = .fullScreen
self.present(arBroadcastVC, animated: true, completion: nil)
} else {
// TODO: add visible msg to user
print("unable to launch a broadcast without a channel name")
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.