Agora.io Live Streaming for iOS

Video live streaming has been a trend in the social industry the past few years, application and game developer have implemented features into their application, game enhance the live streaming process for the users. Hence, in this tutorial we will share a some easy and better experiences with live streaming and quickly add real-time video calls, interactive broadcasting and voice calls to your app. Let’s get started if you to build a live-streaming app for iOS, you don’t have to video expert. Using a mobile Agora SDK.it is easy to use and we can implement it’s features in our application and game. Using these tools, you can build Agora SDK.

In the tutorial we’re going to build Agora SDK a live-streaming app for iOS.First let’s go to the Agora.io developer site. Following steps to Build SDK.

Step 1: Create a developer account at www.agora.io.
Step 2: Developer dashboard

After signing in, you’ll land in the developer dashboard?—?this is where you’ll access all the developer resources.
Navigate to the “Projects”tab in the top-left, a default project has been created.
You will see the App ID?—?which serves as your API key to use Agora’s services.
You can rename or get new App IDs by adding new projects.

Step 3: Download the APIs
Click on the “Download” tab to navigate to the downloads page.
You will find all of Agora’s APIs, including Interactive Live Broadcasting APIs, Video-Call APIs, Voice-Call APIs, Gaming Voice APIs and add-on modules.
Download the APIs of your choice.

Agora SDK
The Agora SDK is designed to be flexible in incorperating the SDK to real-time applications such as IoT, education, social, financial, and network acceleration.
API Usage Guide and Use Cases
Productized core module: more customized, split the original SDK on demand
Modular audio and video processing interface: easier to integrate third-party SDK

The Agora Native SDK
The Agora Native SDK is available to developers on iOS, Android, Windows, and Mac platforms. It has all the necessary voice and video codecs built-in, along with the logic to access the Agora Global Network and automatically respond to disconnections and varying network conditions. Developers simply need the provided high-level APIs. Everything else is built in.

Features

  • Voice call
  • Video call
  • Interactive Broadcasting

Voice call
High fidelity, 3D surround sound experience
48kHz full-band acquisition: highly restored acoustic sound.
3A algorithm based on machine learning: echo cancellation, automatic gain, noise suppression.
Hearing enhancement: two-channel, panoramic sound, listening sound, mixing, reverb effects, ear return, voice change
Setting up Your Development Environment
This page contains information on how to prepare the development environment before enabling a voice call with the Agora Voice SDK.
Xcode 9.0+.
Physical iOS device 8.0+ (iPhone or iPad).
Ensure that your project has a validated provisioning profile certificate.
Basic Methods :-
AgoraRtcEngineKit is the basic interface class of the Agora Native SDK. Creating an AgoraRtcEngineKit object and then calling the methods of this object enables the use of the Agora Native SDK’s communication functionality.

+(instancetype _Nonnull)sharedEngineWithAppId:(NSString * _Nonnull)appId delegate:(id _Nullable)delegate;

This method initializes the AgoraRtcEngineKit class as a singleton instance. Call this method to initialize the service before using AgoraRtcEngineKit.

The SDK uses Delegate to inform the application on engine runtime events. All methods defined in Delegate are optional implementation methods.

  • (int)setChannelProfile:(AgoraChannelProfile)profile;
  • (int)enableAudio;
  • (int)disableAudio;

Join a Channel (joinChannelByToken)

  • (int)joinChannelByToken:(NSString * _Nullable)token
    channelId:(NSString * _Nonnull)channelId
    info:(NSString * _Nullable)info
    uid:(NSUInteger)uid
    joinSuccess:(void(^ _Nullable)(NSString * _Nonnull channel, NSUInteger uid, NSInteger elapsed))joinSuccessBlock;

Video call
Basic Methods: AgoraRtcEngineKit is the basic interface class of the Agora Native SDK. Creating an AgoraRtcEngineKit object and then calling the methods of this object enables the use of Agora Native SDK’s communication functionality.

Join a Channel (joinChannelByToken)

  • (int)joinChannelByToken:(NSString * _Nullable)token
    channelId:(NSString * _Nonnull)channelId
    info:(NSString * _Nullable)info
    uid:(NSUInteger)uid
    joinSuccess:(void(^ _Nullable)(NSString * _Nonnull channel, NSUInteger uid, NSInteger elapsed))joinSuccessBlock;

Users in the same channel can talk to each other; and multiple users in the same channel can start a group chat. Users using different App IDs cannot call each other.
Once in a call, the user must call the leaveChannel method to exit the current call before entering another channel. This method is called asynchronously; therefore, it can be called in the main user interface thread.

Leave a Channel (leaveChannel)

  • (int)leaveChannel:(void(^ _Nullable)(AgoraChannelStats * _Nonnull stat))leaveChannelBlock;

This method allows a user to leave a channel, such as hanging up or exiting a call. After joining a channel, the user must call the leaveChannel method to end the call before joining another one.

Enable the Video Mode (enableVideo)

  • (int)enableVideo;

Disable the Video Mode (disableVideo)

  • (int)disableVideo;
    Enable the Local Video (enableLocalVideo)
  • (int)enableLocalVideo:(BOOL)enabled;

Set the Local Video View (setupLocalVideo)

  • (int)setupLocalVideo:(AgoraRtcVideoCanvas * _Nullable)local;

Set the Remote Video View (setupRemoteVideo)

  • (int)setupRemoteVideo:(AgoraRtcVideoCanvas * _Nonnull)remote;

Interactive Broadcasting
Basic Methods :- AgoraRtcEngineKit is the basic interface class of Agora Native SDK. Creating an AgoraRtcEngineKit object and then calling the methods of this object enables the use of Agora Native SDK’s communication functionality.
Initialize (sharedEngineWithAppId)

  • (instancetype _Nonnull)sharedEngineWithAppId:(NSString * _Nonnull)appId
    delegate:(id _Nullable)delegate;
    Set the Channel Profile (setChannelProfile)
  • (int)setChannelProfile:(AgoraChannelProfile)profile;

Set the User Role (setClientRole)

  • (int)setClientRole:(AgoraClientRole)role;

Enable the Audio Mode (enableAudio)

  • (int)enableAudio;
    Disable the Audio Mode (disableAudio)
  • (int)disableAudio;

Enable the Video Mode (enableVideo)

  • (int)enableVideo;

Disable the Video (disableVideo)

  • (int)disableVideo;

Enable the Local Video (enableLocalVideo)

  • (int)enableLocalVideo:(BOOL)enabled;
  • Set the Local Video View (setupLocalVideo)
  • (int)setupLocalVideo:(AgoraRtcVideoCanvas * _Nullable)local;

This method configures the video display settings on local machine. The application calls this method to bind with the video window (view) of local video streams and configure the video display settings.
Call this method after initialization to configure the local video display settings before entering a channel.

After leaving the channel, the bind is still valid, which means the window still displays. To unbind the view, set the view value to NIL when calling setupLocalVideo.