Introduction
Welcome to the documentation for AgoraRTC SDK Special for iOS! This SDK allows you to integrate real-time communication services into your iOS applications. With AgoraRTC SDK Special, you can build powerful applications that support voice and video communication.
Features
- Real-time audio and video transmission
- High-quality audio and video calls
- Support for multi-party conferences
- Screen sharing capabilities
- Integration with third-party services
Prerequisites
Before getting started with AgoraRTC SDK Special for iOS, make sure you have the following:
- An Apple Developer Account
- Xcode installed on your development machine
- An iOS device running iOS 9.0 or above
- Basic knowledge of Swift programming language
Installation
To install AgoraRTC SDK Special for iOS, follow these steps:
- Create a new iOS project in Xcode.
- Open the project directory in the terminal.
- Run the following command to install the AgoraRTC SDK Special using CocoaPods:
pod 'AgoraRTC-SDK-Special'
- Open the project in Xcode and import the AgoraRTC SDK Special using the following code:
import AgoraRTC
Initialization
To initialize the AgoraRTC SDK Special, follow these steps:
- Import the AgoraRTC module in your Swift file.
- Create an instance of the AgoraRtcEngine class.
- Set the delegate for receiving callbacks from the SDK.
- Initialize the AgoraRtcEngine instance using your App ID.
import AgoraRTC
class MyViewController: UIViewController, AgoraRtcEngineDelegate {
var agoraKit: AgoraRtcEngineKit!
override func viewDidLoad() {
super.viewDidLoad()
agoraKit = AgoraRtcEngineKit.sharedEngine(withAppId: "YOUR_APP_ID", delegate: self)
}
// Implementation of delegate methods...
}
Usage
Once the AgoraRTC SDK Special is initialized, you can use its functions and callbacks to enable real-time communication in your iOS application. Here are some examples:
Joining a Channel
To join a channel, call the joinChannel
method on the AgoraRtcEngine instance.
agoraKit.joinChannel(byToken: "YOUR_CHANNEL_TOKEN", channelId: "YOUR_CHANNEL_ID", info: nil, uid: 0) { (channel, uid, elapsed) in
// Joining channel successful
}
Publishing Local Stream
To publish the local stream, call the setClientRole
method on the AgoraRtcEngine instance.
agoraKit.setClientRole(.broadcaster) { (errCode) in
// Role changed successfully, local stream published
}
Subscribing to Remote Stream
To subscribe to a remote stream, call the subscribe
method on the AgoraRtcEngine instance.
agoraKit.subscribe(toUid: uid, with: .low) { (uid, elapsed) in
// Subscription successful, remote stream available
}
Conclusion
Congratulations! You have successfully set up AgoraRTC SDK Special for iOS in your project. You can now explore and utilize the various features and functions provided by the SDK to build powerful real-time communication applications for iOS.