Agora provides an open-source API-Examples sample project on GitHub. This page introduces how to run this project and experience a live audio streaming implemented by the Agora SDK.
To create an Agora project, do the following:
Agora automatically assigns each project an App ID as a unique identifier.
To copy this App ID, find your project on the Project Management page in Agora Console, and click the icon in the App ID column.
To ensure communication security, Agora recommends using tokens to authenticate users joining a channel.
For testing purposes, Agora Console supports generating RTC temporary tokens. To generate an RTC temporary token:
Download the latest Voice SDK, and fill in the samples/APIExample/APIExample/Common/KeyCenter.swift
file with the App ID and temporary token generated in Agora Console.
struct KeyCenter {
// Replace #Your App Id# with your App ID, and add quotation marks around it, such as "xxxxxx"
static let AppId: String = <#Your App Id#>
// Replace #Temp Access Token# with your temporary Token, and add quotation marks around it, such as "xxxxxx"
static var Token: String? = <#Temp Access Token#>
}
Run pod install
in the samples/API-Example
directory, and wait for the installation to complete.
Connect your computer to an iOS device, click on the APIExample.xcworkspace
file to open the API-Example
project with Xcode, and check your iOS device in the iOS Device option.
In Signing & Capabilities under the project TARGETS, check Automatically manage signing, and configure your Apple developer account and Bundle Identifier.
Click to start compiling.
When the compilation is successful, the app appears on your iOS device. You can open the app after you set it as a app from a trusted developer in your iOS system settings.
Once you open the app, click Join a channel (Audio), enter the channel name that you used to generate the temporary token, such as test
, and click Join.
You can now start interactive live audio streaming as local host
. You can invite your friend to join your live channel as remote host
through the Agora Web sample app using the same App ID, channel name, and temporary token.