This is a demo project for the Agora RTC Extension for Cocos Creator, showcasing various real-time communication scenarios using the Agora RTC SDK.
The main scene serves as the entry point of the application. It provides:
-
Permission Request Buttons — Three buttons to request device permissions:
- 📷 Camera Permission — Request access to the camera for video capture
- 🎤 Microphone Permission — Request access to the microphone for audio capture
- 🖥️ Screen Sharing Permission — Request access to screen sharing
-
Scene Selection — A list of four demo scenarios that you can select and navigate to by clicking the "Go" button.
| Scenario | Description |
|---|---|
| Single Camera | Join a channel with a single camera for basic 1-on-1 or group video calls. |
| Multi Camera | Join the same channel with two cameras and two user IDs for multi-camera video calls. Ideal for scenarios requiring multiple camera angles. |
| Camera + Screen Share | Join a channel with both camera and screen sharing enabled simultaneously. Perfect for presentations and remote collaboration. |
| Media Player | Join a channel with a media player for video calls while streaming media files to remote users. |
| Scenario | Android | iOS | Windows | macOS | Chrome Desktop |
|---|---|---|---|---|---|
| Single Camera | ✅ | ✅ | ✅ | ✅ | ✅ |
| Multi Camera | ❌ | ✅ | ✅ | ✅ | |
| Camera + Screen Share | ✅ | ✅ | ✅ | ||
| Media Player | ✅ | ✅ | ✅ | ✅ | ✅ |
⚠️ Notes:
- ¹ Multi Camera on iOS requires iPhone XR or later, with iOS 13.0 or above.
- ² Screen Sharing on iOS requires additional setup for Broadcast Upload Extension. See Agora iOS Screen Sharing Documentation.
- ³ Screen Sharing on macOS: If you can see the screen window icons and thumbnails but get a black screen after clicking "Start", the permission was not properly granted. To fix: Stop Xcode → System Settings → Privacy & Security → Screen Sharing → Remove
Agora-Rtc-Extension-Demo-desktop→ Click (+) to re-add from<your_project_path>/build/mac/proj/Debug/Agora-Rtc-Extension-Demo-desktop→ Re-run Xcode → Enter main scene → Click Screen permission button → If Xcode log shows success and no system dialog appears, permission is granted.
- Clone this repository
- Clone the Agora RTC Extension plugin into the
extensionsdirectory and checkout themainbranch:cd extensions git clone https://github.com/xiayangqun/agora-rtc-extension-for-cocos-creator.git cd agora-rtc-extension-for-cocos-creator git checkout main
- Build the Agora RTC Extension plugin:
cd extensions/agora-rtc-extension-for-cocos-creator npm install npm run build - Build the native permissions plugin:
cd extensions/agora-demo-native-permissions npm install npm run build - Open the project in Cocos Creator, go to Extensions panel, click Refresh, and activate both plugins
- Edit
assets/resources/appid.jsonto configure your Agora App ID and Token:Get your App ID and Token from the Agora Console{ "appId": "YOUR_APP_ID", "token": "YOUR_TOKEN" } - Run the
mainscene - Click the permission buttons to grant device access
- Select a demo scenario and click "Go" to navigate
这是 Agora RTC Extension for Cocos Creator 的演示项目,展示了使用 Agora RTC SDK 实现的各种实时通信场景。
主场景是应用程序的入口,提供以下功能:
-
权限申请按钮 — 三个用于申请设备权限的按钮:
- 📷 摄像头权限 — 申请访问摄像头,用于视频采集
- 🎤 麦克风权限 — 申请访问麦克风,用于音频采集
- 🖥️ 屏幕共享权限 — 申请访问屏幕共享功能
-
场景选择 — 包含四个演示场景的列表,选中后点击 "Go" 按钮即可跳转到对应场景。
| 场景 | 描述 |
|---|---|
| 单摄像头 (Single Camera) | 使用单个摄像头加入频道,进行一对一或多人视频通话。 |
| 多摄像头 (Multi Camera) | 使用两个摄像头和两个用户 ID 加入同一频道,实现多摄像头视频通话。适用于需要多个拍摄角度的场景。 |
| 摄像头 + 屏幕共享 (Camera + Screen Share) | 同时使用摄像头和屏幕共享加入频道。适合演示和远程协作场景。 |
| 媒体播放器 (Media Player) | 使用媒体播放器加入频道,在进行视频通话的同时向远端用户推送媒体文件流。 |
| 场景 | Android | iOS | Windows | macOS | Chrome Desktop |
|---|---|---|---|---|---|
| 单摄像头 (Single Camera) | ✅ | ✅ | ✅ | ✅ | ✅ |
| 多摄像头 (Multi Camera) | ❌ | ✅ | ✅ | ✅ | |
| 摄像头 + 屏幕共享 (Camera + Screen Share) | ✅ | ✅ | ✅ | ||
| 媒体播放器 (Media Player) | ✅ | ✅ | ✅ | ✅ | ✅ |
⚠️ 说明:
- ¹ 多摄像头 在 iOS 上需要 iPhone XR 或更高机型,且系统版本需 iOS 13.0 或以上。
- ² 屏幕共享 在 iOS 上需要额外配置 Broadcast Upload Extension。详见 Agora iOS 屏幕共享文档。
- ³ macOS 屏幕共享:如果已获取屏幕窗口图标和缩略图,但点击"开始"后显示黑屏,说明权限未正确授予。解决方法:停止 Xcode → 系统设置 → 隐私与安全性 → 屏幕共享 → 删除
Agora-Rtc-Extension-Demo-desktop→ 点击 (+) 重新添加,路径为<你的项目路径>/build/mac/proj/Debug/Agora-Rtc-Extension-Demo-desktop→ 重新运行 Xcode → 进入 main 场景 → 点击 Screen 授权按钮 → 若 Xcode 日志显示成功且无系统弹窗,则权限已授予。
- 克隆此仓库
- 克隆 Agora RTC Extension 插件到项目的
extensions目录下,并检出main分支:cd extensions git clone https://github.com/xiayangqun/agora-rtc-extension-for-cocos-creator.git cd agora-rtc-extension-for-cocos-creator git checkout main
- 构建 Agora RTC Extension 插件:
cd extensions/agora-rtc-extension-for-cocos-creator npm install npm run build - 构建原生权限插件:
cd extensions/agora-demo-native-permissions npm install npm run build - 使用 Cocos Creator 打开项目,进入扩展面板,点击刷新,激活两个插件
- 修改
assets/resources/appid.json配置你的 Agora App ID 和 Token:从 Agora Console 获取你的 App ID 和 Token{ "appId": "YOUR_APP_ID", "token": "YOUR_TOKEN" } - 运行
main场景 - 点击权限按钮授予设备访问权限
- 选择一个演示场景,点击 "Go" 跳转
This project is for demonstration purposes. See the Agora RTC Extension for license information.