Video Call
  • iOS : Objective-C
  • Android
  • macOS
  • Windows
  • Linux
  • Web
  • WeChat Mini Program
  • Flutter
  • Electron
  • Unity3D
  • uni-app
  • React Native
  • Cocos2D
  • Introduction
  • Sample codes
  • Client SDKs
    • SDK downloads
    • Release notes
    • Upgrade guide
  • Getting started
    • Integrate the SDK
    • Implement a basic video call
    • Use Tokens for authentication
  • Guides
    • Common video config
    • Common audio config
    • Real-time messaging
    • Enhancing call quailty
    • Stream mixing
    • Playing media files
    • Playing streams via URL
    • Basic face beautification features
    • Voice changing/Reverb/Virtual stereo
    • Screen sharing
    • Local media recording
    • Advanced features
    • Quotas and Limits
  • Tutorials
  • Error codes
  • Server APIs
  • API Documents
  • FAQ
Sample Code
Download

Guidelines for Running Sample Codes

ZEGOCLOUD no longer classifies environments into production environments and testing environments.

If you create your project in ZEGOCLOUD Admin Console on/before 2021-11-16, refer to the Testing environment deprecation to upgrade the SDK and adjust related codes.

Prerequisites

  • Please ensure that the development environment meets the following technical requirements:
    • Xcode 7.0 or above.
    • iOS device or simulator with iOS 9.0 or above and supports audio and video (real device is recommended).
    • The iOS device is connected to the Internet.
  • project has been created in ZEGOCLOUD Console and a valid AppID have been applied.

Run the Sample Codes

  1. Open AppStore, search for "Xcode", download and install it.

  2. Use Xcode to open "ZegoExpressExample.xcodeproj".

    1. Open Xcode and select "File > Open..." in the upper left corner.

    2. Select "ZegoExpressExample.xcodeproj" in the unzipped sample code folder, and click "Open".

  3. Log in to your Apple ID account.

    1. Open Xcode and select "Xcode > Preferences..." in the upper left corner.

      /Pics/iOS/ZegoExpressEngine/Common/xcode_preferences.png

    2. Click the "Account" tab, click the "+" in the lower left corner to sign, select to add an Apple ID, and click "Continue".

    3. Enter Apple ID and Password to log in.

  4. Modify the developer certificate and Bundle Identifier.

    1. Open Xcode and click the "ZegoExpressExample" project on the left.

    2. Open the ARGETS. Developers can click the "General" tab to modify the Bundle Identifier of the project according to their needs; click the "Signing & Capabilities" tab to select their own developer certificate.

      /Pics/iOS/ZegoExpressEngine/Common/bundle_id.png
      /Pics/iOS/ZegoExpressEngine/Common/team_signing_new.png

  1. The downloaded sample code lacks the AppID, userID and Token required for SDK initialization. You need to modify the "KeyCenter.m" file in the "ZegoExpressExample" directory.
// Developers can get appID from admin console.
// https://console.zego.im/dashboard
// for example: 123456789;
static unsigned int _appID = <#Enter your appID#>;

// Developers should customize a user ID.
// for example: @"zego_benjamin";
static NSString *_userID = @"<#Enter your userID#>";

// Developers can get token from admin console.
// https://console.zego.im/dashboard
// Note: The user ID used to generate the token needs to be the same as the userID filled in above!
// for example: @"04AAAAAxxxxxxxxxxxxxx";
static NSString *_token = @"<#Enter your token#>";
  1. Connect the iOS device to the development computer, click "Any iOS Device" in the upper left corner of Xcode to select the iOS device (or simulator).

    /Pics/iOS/ZegoExpressEngine/Common/xcode_select_device_new.png
    /Pics/iOS/ZegoExpressEngine/Common/xcode_select_real_device_new.png

  2. Click the Build button in the upper left corner of Xcode to compile and run the sample code.

    /Pics/iOS/ZegoExpressEngine/Common/build_and_run_new.png

Experience Real-time Audio and Video Functions

We recommend you run your project on a real device. If your app runs successfully, you should hear the sound and see the video captured locally from your device.

To test out the real-time audio and video features, visit the ZEGO Express Web Demo, and enter the same AppID, Server and RoomID to join the same room. If it runs successfully, you should be able to view the video from both the local side and the remote side, and hear the sound from both sides as well.

In audio-only scenarios, no video will be captured and displayed.

FAQ

  1. Compile the sample code time report 'The app ID "im.zego.ZegoExpressExample" cannot be registered to your development team. Change your bundle identifier to a unique string to try again.' What should I do?

    Refer to the steps of "Modify Developer Certificate and Bundle Identifier" in the above Run the Sample Codes, switch to your own development certificate in "Targets > Signing & Capabilities" and modify "Bundle Identifier" before running.