aircore logo symbol
aircore logo

    Start Here

    What is Aircore?

    Authentication

    Channels

  • SDKs

    SDKs

    • Sync Audio

      iOS

      Quickstart
      Customization
      Samples
      Download SDK
      API Reference

      Android

      (Compose)

      Quickstart
      Sample
      Download SDK
      API Reference

      Android

      (View)

      Quickstart
      Sample
      Download SDK
      API Reference

      Web

      Quickstart
      Samples
      Download SDK
      API Reference

      Flex Audio

      iOS

      Quickstart
      More Options
      Sample
      Download SDK
      API Reference

      Android

      Quickstart
      Download SDK
      API Reference

Sync Audio SDK for iOS: Quickstart

With the Sync Audio SDK for iOS, you can quickly add high-quality, real-time voice chat to your app. Sync SDKs offer a ready-to-use, best-in-class user experience that you can customize completely.

This SDK uses our advanced media optimization and adaptation framework and our world-wide media distribution system.

It provides high-quality, low-latency multi-party voice chat with up to 24 users speaking. Its responsive design automatically handles a wide variety of screen sizes and form factors.

The prebuilt UI panel has expanded and collapsed states:

Expanded state
Collapsed state

Before starting

Minimum versions

  • iOS: 13.0

  • Xcode 13.3

Limitations

  • For M1 and M2 Macs, you must run Xcode using Rosetta.

  • As of Xcode 14, bitcode is deprecated. With older versions of Xcode, turn off bitcode in your project's build settings to use this SDK.

Install the SDK

  1. Open the Xcode workspace for your app.

  2. Click File, then click Add Packages.

  3. Copy and paste this URL into the search box:

    https://github.com/aircoreio/aircore-media-panel-ios
    
  4. Select the Up to Next Major Version dependency rule.

  5. Click Add Package.

  6. You may see the Choose Package Products dialog. Click Add Package.

  7. If you have issues with building after adding the package:

    Open the File menu, then Packages, then click Reset Package Caches.

Request permissions

This SDK requests microphone permissions. To tell the user why the app needs access, you must set the NSMicrophoneUsageDescription property.

Authenticate

For this guide, we recommend that you use a publishable API key for a quick setup. To get your API key:

  1. Create an app in the Aircore Developer Console.

  2. Copy your API key and use it in the next section. For a quick setup, start with a publishable API key.

For an overview of API keys, see Authentication.

Set up your app

Create the client

The Client object is the primary controller that powers this SDK. The client can seamlessly integrate your existing user and channel models.

You can use the client to:

  • Configure user metadata
  • Join a channel to connect to a real-time session with other users
  • Control logging
  • Listen to events that happen behind the scenes

Using a publishable API key

To quickly integrate this SDK, create the client with a publishable API key:

import AircoreMediaPanel

// Use a publishable API key directly from the Aircore Developer Console
let client = Client.create(publishableKey: key, userID: userID)

Using a secret API key and session auth token

For better security, you can also create the client with a session auth token:

import AircoreMediaPanel

// Use a session auth token that your server gets from the Aircore Provisioning
// Service using a secret API key
let client = Client.create(authToken: authToken, userID: userID)

Set user properties

After creating the Client, set these properties to represent the user:

client.userDisplayName = "Jane Doe"
client.userAvatarURL = "http://user-profile-picture.png"

Set up the panel

Set up the UI text

Create a MediaPanelConfiguration object to control the UI text and default behavior. You only need to specify the parameters that you want to customize.

let config = MediaPanelConfiguration(
    // All parameters are optional. Add parameters that you want to customize.
    panelTitle: "My Channel",
    panelSubtitle: "My Channel is a happy space where people can have fun"
)

You can change any text on the panel. See Customize the UI text.

Set the theme

By default, the panel uses a light theme. To use a dark theme, create an optional Theme object:

let myTheme = Theme.dark()

You can also create a custom theme. See Customize the theme.

Customize the user experience

To customize the user experience, you can choose which users can publish audio.

The panel shows all users as they join. By default, users start with a muted microphone. To start publishing audio, users tap the microphone button on the panel.

Create an audience

You can change the panel options and permissions to build an app in which some users speak and others just listen.

To create an audience, you can stop users from unmuting. To hide the microphone button, set showMicrophoneButton to false.

It's best to also keep the audience muted by using permissions. To do this, use a secret API key. You can't do this with a publishable API key because it lets all users publish audio.

To mute certain users, request and send out session auth tokens that don't allow publishing audio.

Token permissions don't affect the showMicrophoneButton setting. If the setting is true, users that can't publish audio can still see and press the button, but it doesn't do anything.

Automatically publish audio

To have users publish automatically, set autoPublishMicOnJoin to true.

Create and show the panel

You can now create the MediaPanel object, which shows the panel in your existing view controller:

client.connect(channelID: channel)

let panel = MediaPanel(
    client: client,
    channelID: channel,
    configuration: configuration,
    theme: myTheme // Optional
)

panel.present(in: self, style: .bottomBar)

Respond to notifications and errors

You can subscribe to events and errors and respond accordingly:

client.on(.localUserJoined) { channelID, userID in
    print("I just joined a call!")
}

client.on(.sessionAuthTokenNearingExpiry) { channelID, userID in
    // Get a new session auth token from your server and update the client
}

client.on(.sessionAuthTokenInvalid) { channelID, userID in
    // Get a valid session auth token from your server and update the client
}

client.onError { channelID, error in
    // Handle any errors
}

See the complete references for events and errors.

Tear down and clean up

You can tear down the client and the panel as follows:

// Disconnecting a specific channel ID
client.disconnect(fromChannelID: channel)

// Tear down the client
// This disconnects automatically from all connected channels
client.destroy()

To use another panel after calling destroy(), create a new Client instance.

More info

  • To continue customizing the panel, see Customization.

  • See the full API reference.

  • Download our sample apps.

  • on this page
  • Sync Audio SDK for iOS: Quickstart

  • Before starting

  • Install the SDK

  • Authenticate

  • Set up your app

  • Set up the panel

  • Customize the user experience

  • Create and show the panel

  • Respond to notifications and errors

  • Tear down and clean up

  • More info