This topic describes how to run the demo project of ApsaraVideo Real-time Communication (ARTC) to try out ARTC features on iOS.
Download source code
ApsaraVideo Live provides open-source sample projects to demonstrate the API usage of ARTC SDK, helping developers understand and integrate the ARTC features. To download the source code, visit GitHub repository.
Environment requirements
Before running the demo project, ensure your development environment meets the following requirements:
Development tool: Xcode 14.0 or later. The latest official version is recommended.
Recommended configuration: CocoaPods 1.9.3 or later.
Test device: A device running iOS 9.0 or later.
We recommend using physical devices for testing, as emulators may not support all features.
Network: A stable Internet connection.
Application setup: Obtain the AppID and AppKey of the ARTC application.
Procedure
Step 1: Get the demo project
Clone the ARTC demo project to your local device:
git clone https://github.com/MediaBox-Demos/amdemos-artcThis repository contains demo projects for multiple native platforms. The iOS demo project is located in the iOS/ directory.
The demo project includes code for generating tokens on the client side. This is for demonstration and testing purposes only. In a production environment, tokens must be generated on a secure server to protect your AppKey.
File structure of the iOS/ARTCExample project:
├── iOS // Root directory for iOS project
│ ├── ARTCExample // API Example project directory
│ ├── Common // Common module
│ ├── ARTCTokenHelper.swift // AppId and AppKey information
│ ├── ... // Other files
│ ├── QuickStart // Quick start module
│ ├── TokenGenerate // Token generation and channel joining
│ ├── VideoCall // Quick implementation of audio/video call
│ ├── VoiceChat // Quick implementation of voice chat room
│ ├── Setting // Settings module
│ ├── ... // Other project files
│ ├── ARTCExample.xcodeproj // Xcode project file for the demo
│ ├── ARTCExample.xcworkspace // Xcode workspace for the demo
│ ├── Podfile // Demo podfile
Step 2: Configure the demo project
After downloading the source code, open the iOS directory in the terminal.
In the iOS directory, run the command
pod install --repo-updateto install the the required SDK dependencies.Open the
ARTCExample.xcworkspacefile in Xcode.Navigate to the
iOS/ARTCExample/Common/ARTCTokenHelper.swiftfile and enter the AppID and AppKey obtained from the console.
// ARTCTokenHelper.swift
class ARTCTokenHelper: NSObject {
/**
* RTC AppId
*/
public static let AppId = "<AppID of your ARTC application>"
/**
* RTC AppKey
*/
public static let AppKey = "<AppKey AppID of your ARTC application>"
...
}Step 3: Compile and run the demo project
Select the ARTCExample Target, connect a physical device to your computer, and compile to install the application.
Run the application on the test device to try out the ARTC features.
On the test device, open the application and tap Video Call to test this feature.
| To test video call, use the same channel ID to join the call on two devices.
| The call starts, and you can see the video streams from both devices.
|


