English | 中文
This repository contains sample projects using the Agora RTC Objective-C SDK for iOS.
The project uses a single app to combine a variety of functionalities. Each function is loaded as a storyboard for you to play with.
Function | Location |
---|---|
Live streaming | LiveStreaming.swift |
Custom audio capture | CustomAudioSource.swift |
Custom video renderer | CustomVideoRender.swift |
Raw audio and video frames (Objective-C with C++, uses AgoraMediaRawData.h ) |
RawMediaData.swift |
Raw audio frames (Native Objective-C interface) | RawAudioData.swift |
Custom video capture (Push) | CustomVideoSourcePush.swift |
Custom video capture (mediaIO) | CustomVideoSourceMediaIO.swift |
Switch a channel | QuickSwitchChannel.swift |
Join multiple channels | JoinMultiChannel.swift |
Join an audio channel | JoinChannelAudio.swift |
Join a video channel | JoinChannelVideo.swift |
Play audio files and audio mixing | AudioMixing.swift |
Voice effects | VoiceChanger.swift |
MediaPlayer Kit | MediaPlayer.swift |
RTMP streaming | RTMPStreaming.swift |
Audio/video stream SDK/custom encryption | StreamEncryption.swift |
Video metadata | VideoMetadata.swift |
Group video chat | VideoChat.swift |
Pre-call test | PrecallTest.swift |
Channel media relay | MediaChannelRelay.swift |
Super resolution | SuperResolution.swift |
Use multi-processing to send video streams from screen sharing and local camera | ScreenShare.swift |
Use custom video source (mediaIO) to implement AR function | ARKit.swift |
Send data stream | CreateDataStream.swift |
Geofencing | GlobalSettings.swift |
- Xcode 10.0+
- Physical iOS device (iPhone or iPad)
- iOS simulator is NOT supported
-
Navigate to the iOS folder and run following command to install project dependencies:
$ pod install
-
Open the generated
APIExample.xcworkspace
file with Xcode. -
Edit the
KeyCenter.swift
file.- Replace
YOUR APP ID
with your App ID. - Replace
YOUR Certificate
with the Certificate.
/** Agora assigns App IDs to app developers to identify projects and organizations. If you have multiple completely separate apps in your organization, for example built by different teams, you should use different App IDs. If applications need to communicate with each other, they should use the same App ID. In order to get the APP ID, you can open the agora console (https://console.agora.io/) to create a project, then the APP ID can be found in the project detail page. */ static let AppId: String = <# YOUR APPID#> /** Agora provides App certificate to generate Token. You can deploy and generate a token on your server, or use the console to generate a temporary token. In order to get the APP ID, you can open the agora console (https://console.agora.io/) to create a project with the App Certificate enabled, then the APP Certificate can be found in the project detail page. PS: If the project does not have certificates enabled, leave this field blank. */ static var Certificate: String? = <#YOUR Certificate#>
See Get Started with Agora to learn how to get an App ID and access token. You can get a temporary access token to quickly try out this sample project.
The Channel name you used to generate the token must be the same as the channel name you use to join a channel.
To ensure communication security, Agora uses access tokens (dynamic keys) to authenticate users joining a channel.
Temporary access tokens are for demonstration and testing purposes only and remain valid for 24 hours. In a production environment, you need to deploy your own server for generating access tokens. See Generate a Token for details.
- Replace
-
Build and run the project in your iOS device.
You are all set! Feel free to play with this sample project and explore features of the Agora RTC SDK.
If you have any problems or suggestions regarding the sample projects, feel free to file an issue.
- Check our FAQ to see if your issue has been recorded.
- Dive into Agora SDK Samples to see more tutorials
- Take a look at Agora Use Case for more complicated real use case
- Repositories managed by developer communities can be found at Agora Community
- If you encounter problems during integration, feel free to ask questions in Stack Overflow
After users upgrade their iOS devices to iOS 14.0, and use an app that integrates the Agora RTC SDK for iOS with the version earlier than v3.1.2 for the first time, users see a prompt for finding local network devices. The following picture shows the pop-up prompt:
Refer to the this FAQ to learn how to fix this issue.
The sample projects are under the MIT license.