Skip to content

Instantly share code, notes, and snippets.

@digitallysavvy
Created November 27, 2019 17:52
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/3e6dc4edcba47e65bdde8d6a4e18feb4 to your computer and use it in GitHub Desktop.
Save digitallysavvy/3e6dc4edcba47e65bdde8d6a4e18feb4 to your computer and use it in GitHub Desktop.
Snippet to set the video configuration within the viewDidLoad for the ARSupportAudienceViewController
func setupLocalVideo() {
guard let localVideoView = self.localVideoView else { return } // get a reference to the localVideo UI element
// enable the local video stream
self.agoraKit.enableVideo()
// Set video encoding configuration (dimensions, frame-rate, bitrate, orientation)
let videoConfig = AgoraVideoEncoderConfiguration(size: AgoraVideoDimension360x360, frameRate: .fps15, bitrate: AgoraVideoBitrateStandard, orientationMode: .fixedPortrait)
self.agoraKit.setVideoEncoderConfiguration(videoConfig)
// Set up local video view
let videoCanvas = AgoraRtcVideoCanvas()
videoCanvas.uid = 0
videoCanvas.view = localVideoView
videoCanvas.renderMode = .hidden
// Set the local video view.
self.agoraKit.setupLocalVideo(videoCanvas)
// stylin - round the corners for the view
guard let videoView = localVideoView.subviews.first else { return }
videoView.layer.cornerRadius = 25
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment