This article describes how to quickly run the sample source code and experience basic audio and video calling services.
Before you run the sample source code, make sure that the development environment meets the following requirements:
Cocos Creator v3.6.0 or above (it is recommended to download the latest version through Cocos Dashboard).
Ensure the corresponding development environment and equipment according to the platform that needs to run.
Make sure the running device is connected to the Internet.
The current version of the SDK only supports Android / iOS / macOS / Windows native platforms; it does not support the Web (that is, it does not support editor preview, publishing to the Web platform, and mini game platforms).
You can download sample codes for other Cocos Creator editor versions from Github.
Go to ZEGOCLOUD Admin Console to create a new project, and get the AppID and AppSign of your project.
The SDK now also supports using Token for authentication, if you want to change your authentication mode, refer to the Guide for upgrading the authentication mode from using the AppSign to Token.
The following directory structure is the file structure of the project, and the file paths mentioned below are all relative to this directory.
cocos_creator
├── VERSION.txt
└── ZegoExpressExample
├── assets
│ ├── HomeScene.scene # Main scene
│ ├── HomeScene.ts # Script of the main scene
│ ├── KeyCenter.ts # Fill in the AppID and AppSign of the application
│ ├── resources # Resource files
│ ├── topics # Examples
│ └── utils # Utilities
├── native
│ └── engine # Native project config
├── package.json
.
.

After the import is complete, if the console still reports a lot of errors, please restart Cocos Creator.



Go back to Cocos Creator and check if there is still an error in the console. If there is an error, reopen the Extension Manager to find the SDK extension, try to disable the SDK extension first (click the switch), and open the File Explorer / Finder, and then return to Cocos Creator to refresh the resources, and then re-enable the SDK extension. Then open the File Explorer / Finder and return to Cocos Creator until the console does not report an error. If the error is still reported, it may be necessary to restart Cocos Creator several times and repeat the above steps.
Click Assets in the lower left corner of the Cocos Creator Editor, and under the assets directory, double-click the HomeScene file to see the scene of the sample source home page (the home page is a 2D scene).

Click Project > Build in the menu bar, and build native task according to Cocos Creator Publishing to Native Platforms based on documents and actual conditions, a native platform project is constructed.
If the build fails, please open the build log file to view the error message and correct the issue according to the error prompt. If the error message is related to ZEGO SDK and you can't solve it by yourself, please contact ZEGO technical support.

Run the demo.
Run on Android device:
Click Project > Build Release in the menu bar, create a new build task, select "Android" as the target platform, fill in all the required information, click "Build" to generate native project, and click "Make" to start compiling (this step will take a long time ).
After completing the above operations, connect an Android device and click "Run". Or use Android Studio to open the native project directory build/android/proj for operation.
If the build fails, please refer to FAQs 1, 2, and 3 in the Integrate the SDK document.

Run on iOS device:
Click Project > Build Release in the menu bar, create a new build task, select "iOS" as the target platform , fill in all the required information, click "Build" to generate native project, and click "Make" to start compiling (this step will take a long time ).
After completing the above operations, use Xcode to open the build/ios/proj/ZegoExpressExample.xcodeproj native project, then connect an iOS device, select the ZegoExpressExample-mobile target, select the connected device, and click the "Run" button run.
To run on iOS Simulator, please refer to the additional processing steps for iOS project in the Integrate the SDK document.


Run on macOS device:
Click Project > Build Release in the menu bar, create a new build task, select "Mac" as the target platform , fill in all the required information, click "Build" to generate native project, and click "Make" to start compiling (this step will take a long time ).
After completing the above operations, click the Run button, or use Xcode to open the build/mac/proj/ZegoExpressExample.xcodeproj native project.

Run on Windows device:
Click Project > Build Release in the menu bar, create a new build task, select "Windows" as the target platform , fill in all the required information, click "Build" to generate native project, and click "Make" to start compiling (this step will take a long time ).
After completing the above operations, click the Run button, or use Visual Studio to open the build\windows\proj\ZegoExpressExample.sln native project.

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.
