Express-Video SDK
  • Platform
  • Framework / Engine
  • iOS
  • Android
  • macOS
  • Windows
  • Linux
  • Web
  • WeChat Mini Program
Sample Code
Download
Note

1 Sample code running guide

1.1 Prepare the environment

Please ensure that the development environment meets the following technical requirements:

  • Windows system: win7 and above, with Visual Studio 2015 and above installed.
  • macOS system: XCode is installed.
  • CMake has been installed.
  • Qt5.9 and above have been installed. Developers who use Qt for the first time can read its [Official Tutorial](https: //doc.qt.io/qt-5/gettingstarted.html).
  • External devices that support audio and video functions such as microphones and cameras are normal.

1.2 Prerequisites

  1. Please go to Console Management Console to register an account and apply for the AppID and AppSign required to initialize the SDK. For the application process, please refer to ZEGO Admin Console User Manual.

  2. After installing CMake and Qt, you need to add environment variables:

    The CMake and Qt paths provided below are for reference only, and users need to fill in according to the actual path on their device.

  • Windows system:
  1. Modify environment variables: add C:\Program Files\CMake\bin to Path
  2. Modify environment variables: add C:\Qt\Qt5.9.8\5.9.8\msvc201d5\bin to Path
  3. Modify environment variables: add C:\Qt\Qt5.9.8\5.9.8\msvc2015_64\bin to Path
  4. Add user variable: add QT_DIR user variable as C:\Qt\Qt5.9.b8\5.9.8\msvc2015
  5. Add user variable: add QT_DIR_x64 user variable as C:\Qt\Qt5.9.8\5.9.8\msvc2015_64
  • macOS system:
export PATH="/Users/zego/Qt5.9.8/5.9.8/clang_64/bin:$PATH"
export QTDIR="/Users/zego/Qt5.9.8/5.9.8/clang_64/"

1.3 Sample code directory structure

The following is the file structure of the video subdirectory, and the file paths mentioned below are relative to this directory.

.
├── CMakeLists.txt
├── README.ZH.md
├── README.md
├── build-mac
│ └── generate_mac.sh-------------------------Used to generate xcode project
├── build-win
│ ├── generate_vs2013_x64.bat-----------------used to generate vs project
│ ├── generate_vs2013_x86.bat
│ ├── generate_vs2015_x64.bat
│ └── generate_vs2015_x86.bat
├── libs
│ └── ZegoExpress
│ ├── mac---------------------------------ZegoExpressVideo Mac SDK storage directory
│ │ ├── include
│ │ └── lib
│ └── win---------------------------------ZegoExpressVideo Win SDK storage directory
│ ├── include
│ └── lib
│ ├── x64
│ └── x86
└── src
    ├── AppSupport
    │ └── ZegoConfigManager.cpp---------------Fill in the applied AppID and AppSign
    ├── CMakeLists.txt
    └── ZegoExpressExample.pro------------------You can use QtCreator to open the project

1.4 Run the sample code

  1. Download the SDK package, unzip it, and copy the file to the following directory of the sample source code.

If there is already a corresponding SDK file in the downloaded sample source code, please skip this step.

  1. AppID and AppSign required for SDK initialization are missing in the sample code. You need to modify the /src/AppSupport/ZegoConfigManager.cpp file. Please use the AppID and AppSign obtained in the "Prerequisites" of this article to fill in correctly, otherwise the sample code will not work properly run.
unsigned int ZegoConfigManager::getAppID()
{
    return; // input AppID here
}

std::string ZegoConfigManager::getAppSign()
{
    return ""; // input AppSign here
}
  1. Use the IDE to open the project.

    The sample code comes with a Qt project file, which can be opened with Qt Creator on Windows and macOS. For users who need to use Visual Studio or XCode, the cmakelist.txt file is provided in the example, and users can use CMake to generate platform-specific .sln or .xcodeproj project files.

  • Use Qt Creater to open the /src/ZegoExpressExample.pro project file.

  • After generating the .sln project file, use Visual Studio to open it.

  1. Double-click /build-win/generate_vs2015_x86.bat, a 32-bit sln project will be generated under the /build-win/cmake_temp_x86 directory.
  2. Double-click /build-win/generate_vs2015_x64.bat, a 64-bit sln project will be generated under the /build-win/cmake_temp_x64 directory.
  • After generating the .xcodeproj project file, open it with XCode.

Execute the /build-mac/generate_mac.sh script, and the xcode project will be generated in the /build-mac/cmake_temp directory.

  1. Compile and run the project project.