Configure Video layouts
Video Conference Kit (ZegoUIKitPrebuiltVideoConference) currently supports the gallery
layout, and more layouts, and each layout has its own configuration.
To choose the layout you want, use the layout
parameter in the ZegoUIKitPrebuiltVideoConferenceConfig
.
To customize the gallery layout, use the gallery
parameter:
addBorderRadiusAndSpacingBetweenView
: In gallery layout, this can be used to add border radius and spacing between speaker views. true: enabled (by default). false: disabled.
The effect is as follows:
Adding border radius and spacing | Without border radius and spacing |
---|---|
![]() | ![]() |
Here is the reference code:
Untitled
class ViewController: UIViewController {
let selfUserID: String = "userID";
let selfUserName: String = "userName";
let yourAppID: UInt32 = YourAppID;
let yourAppSign: String = YourAppSign;
let conferenceID : String = "testConferenceID"
@IBOutlet weak var userIDLabel: UILabel! {
didSet {
userIDLabel.text = selfUserID
}
}
@IBOutlet weak var userNameLabel: UILabel! {
didSet {
selfUserName = String(format: "zego_%@", selfUserID)
userNameLabel.text = selfUserName
}
}
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func videoConference(_ sender: Any) {
// Modify your custom configurations here.
let config: ZegoUIkitPrebuiltVideoConferenceConfig = ZegoUIkitPrebuiltVideoConferenceConfig()
let layout: ZegoLayout = ZegoLayout()
layout.mode = .gallery
let layoutConfig: ZegoLayoutGalleryConfig = ZegoLayoutGalleryConfig()
layoutConfig.addBorderRadiusAndSpacingBetweenView = false;
layout.config = layoutConfig
config.layout = layout
let videoConferenceVC = ZegoUIKitPrebuiltVideoConferenceVC.init(yourAppID, appSign: yourAppSign, userID: selfUserID, userName: self.selfUserName ?? "", conferenceID: conferenceID, config: config)
videoConferenceVC.modalPresentationStyle = .fullScreen
self.present(videoConferenceVC, animated: true, completion: nil)
}
}
1