Documentation
VideoCallKit Call Kit
Documentation
Demo APP
SDK Center
API Center
FAQ
Code Market
Console
Sign Up
Log In
中文站 English
  • Documentation
  • Call Kit
  • Quick start
  • Quick start

Quick start

Last updated:2024-05-10 14:02

Integrate the SDK

Add ZegoUIKitPrebuiltCall as dependencies

  • Open Terminal, navigate to your project's root directory, and run the following to create a podfile:
    pod init
  • Edit the Podfile file to add the basic dependency:
    pod 'ZegoUIKitPrebuiltCall'
  • In Terminal, run the following to download all required dependencies and SDK with Cocoapods:
    pod install

Import ZegoUIKit & ZegoUIKitPrebuiltCall to your project

import ZegoUIKit
import ZegoUIKitPrebuiltCall
// YourViewController.swift
class ViewController: UIViewController {
    //Other code...
}

Using the ZegoUIKitPrebuiltCallVC in your project

  • Go to ZEGOCLOUD Admin Console, get the appID and appSign of your project.
  • Specify the userID and userName for connecting the Call Kit service.
  • Create a callID that represents the call you want to make.
  • userID and callID can only contain numbers, letters, and underlines (_).
  • Users that join the call with the same callID can talk to each other.
// YourViewController.swift
class ViewController: UIViewController {
    // Other code...
    var userID: String = <#UserID#>
    var userName: String = <#UserName#>
    var callID: String = <#CallID#>

    @IBAction func makeNewCall(_ sender: Any) {

        // You can also use groupVideo/groupVoice/oneOnOneVoice to make more types of calls.
        let config: ZegoUIKitPrebuiltCallConfig = ZegoUIKitPrebuiltCallConfig.oneOnOneVideoCall()

        let callVC = ZegoUIKitPrebuiltCallVC.init(yourAppID, 
                                                  appSign: yourAppSign, 
                                                  userID: self.userID, 
                                                  userName: self.userName, 
                                                  callID: self.callID, 
                                                  config: config)
        callVC.modalPresentationStyle = .fullScreen
        self.present(callVC, animated: true, completion: nil)
    }
}

Then, you can make a new call by presenting the VC.

Configure your project

Open the Info.plist, add the following code inside the dict part:

<key>NSCameraUsageDescription</key>
<string>We require camera access to connect to a call</string>
<key>NSMicrophoneUsageDescription</key>
<string>We require microphone access to connect to a call</string>

Run & Test

Now you have finished all the steps!

You can simply click the Run in XCode to run and test your App on your device.

Related guide

Custom prebuilt UI

Resources

Sample code
Click here to get the complete sample code.
Page Directory
  • Free trial
  • 提交工单
    咨询集成、功能及报价等问题
    电话咨询
    400 1006 604
    Get Consulting
    Scan Wechat QR code