Created
November 27, 2019 16:20
-
-
Save digitallysavvy/fb93c4aa9e3de60aead539b4e93c139f to your computer and use it in GitHub Desktop.
Snippet for the loadView function within ARSupportBroadcasterViewController
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
override func loadView() { | |
super.loadView() | |
createUI() // init and add the UI elements to the view | |
self.view.backgroundColor = UIColor.black // set the background color | |
// Agora setup | |
guard let appID = getValue(withKey: "AppID", within: "keys") else { return } // get the AppID from keys.plist | |
let agoraKit = AgoraRtcEngineKit.sharedEngine(withAppId: appID, delegate: self) // - init engine | |
agoraKit.setChannelProfile(.communication) // - set channel profile | |
let videoConfig = AgoraVideoEncoderConfiguration(size: AgoraVideoDimension1280x720, frameRate: .fps60, bitrate: AgoraVideoBitrateStandard, orientationMode: .fixedPortrait) | |
agoraKit.setVideoEncoderConfiguration(videoConfig) // - set video encoding configuration (dimensions, frame-rate, bitrate, orientation | |
agoraKit.enableVideo() // - enable video | |
agoraKit.setVideoSource(self.arVideoSource) // - set the video source to the custom AR source | |
agoraKit.enableExternalAudioSource(withSampleRate: 44100, channelsPerFrame: 1) // - enable external audio souce (since video and audio are coming from seperate sources) | |
self.agoraKit = agoraKit // set a reference to the Agora engine | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment