Live Broadcast Integration - iOS

Step 1: Prepare the Environment

Be sure that the following development environment requirements are satisfied:

  • Apple XCode version 6.0 or higher
  • iOS 7.0 or later
  • Real iOS devices with audio and video functionality
  • Agora Native SDK for iOS: Download either of the latest Voice Package and Full Package(Voice and Video) from downloads .

Step 2: Add the Agora SDK

  1. Copy the folder libs from the Agora Native SDK you have downloaded in Step 1: Prepare the Environment to the project folder.

    Note

    Add the required libraries according to either of the following Step 2 or Step 3.

  2. Use CocoaPods to add the libraries automatically.

    1. Install the CocoaPods by running the following command in the terminal:

      brew install cocoapods
      

      For details on how to use the CocoaPods, refer to Cocoapods .

    2. Add the Agora SDK references in the Podfile:

      • For Voice Package:

        pod 'AgoraAudio_iOS'
        
      • For Full Package:

        pod 'AgoraRtcEngine_iOS'
        
  3. Add the libraries manually.

    1. Select the current Target.

    2. Set the search path of framework in Xcode.

    3. Select File> New> Group in Xcode, and name it, for example, as Frameworks to include all the required frameworks from Agora later.

      ../../_images/xcode_3.png
    1. Click the Frameworks folder you’ve just created, and then go to Building Phases.

      ../../_images/xcode_4.png
    2. Expand the Link Binary with Libraries, and click + to add the following libraries.

      ../../_images/ios_project_3.png

      Where:

      AgoraRtcEngineKit.framework is located in the libs folder which you have copied to your project folder on the desktop. After you click +, then click Add Other… on the dialog box and go to your project folder to add it.

      ../../_images/xcode_5.png

Step 3: Access Library

Objective-C

In the file viewController.h, add #import <AgoraRtcEngineKit/AgoraRtcEngineKit.h> to enable the use of Agora Native SDK for iOS.

../../_images/ios_background.png

By default, Agora Native SDK uses libc++ (LLVM). Contact support@agora.io if you prefer to use libstdc++ (GNU).

The SDK provides FAT Image libraries with multi-architecture support for both 32/64-bit audio simulators and 32/64-bit audio/video real devices.

Swift

  1. Create a new bridging file called agora-Bridging-Header.h .

  2. Added the following contents in the bridging file to reference the Agora SDK.

    #import <AgoraRtcEngineKit/AgoraRtcEngineKit.h>
    #import <AgoraRtcCryptoLoader/AgoraRtcCryptoLoader.h>
    
  3. Set the file as Objective-C Bridging Header:

    1. Select the current Target.
    2. Select Building Settings > Swift Compiler-General, and set Objective-C Bridging Header as <targetname>/agora-Bridging-Header.h .

Step 4: Authorize to Use Agora SDK

You need to grant the following items the rights to use Agora SDK:

  • Camera
  • Microphone

Grant the mentioned rights in info.plist:

  • Set Privacy - Camera Usage Description as use camera to start video call

  • Set Privacy - Microphone Usage Description as use microphone to start video call

    ../../_images/info_plist.png

Step 5: Other Settings

  1. Set the Background Modes by selecting Audio, AirPlay, and Picture in Picture .

    ../../_images/ios_background1.png

    Note

    Do NOT select Voice over IP if signaling call is not enabled.

  2. Disable bitcode due to Agora SDK does not support it by selecting the current target and set according to the following:

    ../../_images/bitcode.png

Step 6: Call APIs

Refer to Live Broadcast API - iOS to implement the required functions.