Mac

Updated at:
Copy as MD

Run the Alibaba Real-Time Communication (ARTC) sample project on macOS to test real-time audio and video features.

Download the sample source code

Alibaba Cloud provides an open source sample project that demonstrates the ARTC SDK APIs and helps you integrate the SDK features. Download the project from the Mac sample project repository.

Prerequisites

Before you run the sample project, make sure that your development environment meets the following requirements:

  • Development tools: Xcode 14.0 or later. We recommend the latest official version.

  • Test device: A Mac device that runs macOS 10.13 or later.

  • Network: A stable network connection.

  • Application preparation: Obtain the AppID and AppKey for your ApsaraVideo Real-time Communication application. For more information, see Create Application.

Procedure

Step 1: Get the sample project

Clone the ARTC sample project to your local machine:

git clone https://github.com/MediaBox-Demos/amdemos-artc
Note

This repository contains sample projects for the ARTC SDK on multiple native platforms. The sample project for the Mac platform is in the Mac/ folder.

The sample project includes code to generate a token on the client side for testing.

The file structure of the Mac/ARTCExample project is as follows:

├── Mac                                // Root directory of the Mac project structure
│   ├── ARTCExample                    // Source code directory for API Example
│       ├── Common                     // Common module
│           ├── AppDefine.h            // Set information such as the AppID and AppKey
│           ├── ...                    // Other files
│       ├── QuickStart                 // Quick Start module
│           ├── TokenGenerate           // Token generation and joining a session
│           ├── VideoCall               // Quickly implement audio and video calls
│           ├── VoiceChat               // Quickly implement a voice chat room
│       ├── BasicUsage                 // Basic Features module
│       ├── ...                        // Other project files
│   ├── ARTCExample.xcodeproj          // Demo project

Step 2: Configure the sample project

  1. In the downloaded source code, open the Mac folder.

  2. Refer to Download and integrate the SDK to download the Mac ARTC SDK, and then place it in the ARTCExample folder.

  3. In the Mac folder, open the ARTCExample.xcodeproj project file.

  4. Open the Mac/ARTCExample/Common/AppDefine.h file and set the AppID and AppKey to the values that you obtained from the console.

#define ARTC_APP_ID  <Your AppID>
#define ARTC_APP_KEY <Your AppKey>

Step 3: Compile and run the sample project

  1. In Xcode, select the ARTCExample target and compile the project.

  2. After the compilation succeeds, run the application to test the API Example.