Skip to content

auvious/auvious-sdk-ios

Repository files navigation

AuviousSDK

This is Auvious iOS SDK, which simplifies integration with Auvious services. It provides both an API which allows you to build your custom call/conference UI, and ready out-of-the-shelf UI components/views which simplify integration for the most common scenarios.

Requirements

iOS version >= 13.0

Installation

AuviousSDK is available through as a CocoaPod. You can install it using one of the following ways:

  • Auvious Cocoa Pods Repo. Add the following sources to your Podfile
    source 'https://github.com/auvious/CocoaPodSpecs.git'
    Make sure you also include the official CocoaPods repo source or a valid mirror of it
    source 'https://cdn.cocoapods.org/'
    Last but not least, you need to add the AuviousSDK pod on all targets that will need it
    pod 'AuviousSDK', '1.4.0'
  • Auvious SDK github repo. This method only requires the following line on the target dependencies:
    pod 'AuviousSDK', :git => 'https://github.com/auvious/auvious-sdk-ios.git', :tag => '1.4.0'

Next you need to run pod install in order for AuviousSDK and it's dependencies to be installed in the project workspace.

Finally you'll need disable bitcode in 'Build Settings' and also add NSMicrophoneUsageDescription,NSCameraUsageDescription texts in Info.plist.


Setup Instructions

1. Info.plist Permissions

Add the following keys to your Info.plist to request camera and microphone access:

<key>NSCameraUsageDescription</key>
<string>Camera access is required for video calls.</string>
<key>NSMicrophoneUsageDescription</key>
<string>Microphone access is required for audio calls.</string>

2. Build Settings

Disable Bitcode in your target's Build Settings:

  • Navigate to Build Settings → Enable Bitcode and set it to No.

3. Background Audio (Optional)

If you want audio to continue when the app goes to the background, add the audio background mode to your Info.plist:

<key>UIBackgroundModes</key>
<array>
    <string>audio</string>
</array>

Then enable it in the SDK configuration (see backgroundAudioEnabled below).

4. App Lifecycle Hooks

The SDK needs to be notified when the app moves between foreground and background. Add the following calls in your AppDelegate or SceneDelegate:

import AuviousSDK

// In applicationDidEnterBackground / sceneDidEnterBackground
AuviousConferenceSDK.sharedInstance.onApplicationPause()

// In applicationWillEnterForeground / sceneWillEnterForeground
AuviousConferenceSDK.sharedInstance.onApplicationResume()

Usage Example

Simple Conference (Recommended)

The easiest way to add a conference to your app is using the built-in AuviousConferenceVCNew view controller.

import AuviousSDK

class ViewController: UIViewController {

    func joinConference() {
        // 1. Build the configuration
        let config = AuviousConferenceConfiguration()
        config.username = "<ticket>" // set the auvious ticket
        config.baseEndpoint = "https://auvious.video/"
        config.mqttEndpoint = "auvious.video"

        // 2. Set call mode
        config.callMode = .audioVideo

        // 3. (Optional) Customize the UI
        config.conferenceBackgroundColor = .black
        config.cameraAvailable = true
        config.microphoneAvailable = true
        config.speakerAvailable = true
        config.pipAvailable = true
        config.screenSharingAvailable = false
        config.backgroundAudioEnabled = false

        // 4. Present the conference view controller
        let conferenceVC = AuviousConferenceVCNew(configuration: config, delegate: self)
        present(conferenceVC, animated: true)
    }
}

// MARK: - AuviousSimpleConferenceDelegate

extension ViewController: AuviousSimpleConferenceDelegate {

    func onConferenceSuccess() {
        // Called when the conference ends normally
        print("Conference ended successfully")
    }

    func onConferenceError(_ error: AuviousSDKGenericError) {
        // Called on error (authentication failure, network issues, etc.)
        switch error {
        case .AUTHENTICATION_FAILURE:
            print("Authentication failed — check credentials")
        case .NETWORK_ERROR:
            print("Network error")
        case .PERMISSION_REQUIRED:
            print("Camera or microphone permission denied")
        case .INVALID_TICKET(let ticketId):
            print("Invalid ticket: \(ticketId)")
        default:
            print("Conference error: \(error)")
        }
    }
}

Low-Level Conference API

For full control over the conference flow and UI, use AuviousConferenceSDK directly.

import AuviousSDK

class ConferenceManager: AuviousSDKConferenceDelegate {

    func setup() {
        AuviousConferenceSDK.sharedInstance.delegate = self

        // Configure the SDK
        AuviousConferenceSDK.sharedInstance.configure(
            params: [:],
            username: "<ticket>",
            password: "<password>",
            name: nil,
            clientId: "<client-id>",
            baseEndpoint: "https://auvious.video/",
            mqttEndpoint: "auvious.video"
        )

        // Log in
        AuviousConferenceSDK.sharedInstance.login(
            onLoginSuccess: { [weak self] endpoint in
                self?.joinConference()
            },
            onLoginFailure: { error in
                print("Login failed: \(error)")
            }
        )
    }

    func joinConference() {
        AuviousConferenceSDK.sharedInstance.joinConference(
            conferenceId: "<conference-name>",
            onSuccess: { [weak self] conference in
                // Start publishing local audio/video
                self?.publishLocalStream()
            },
            onFailure: { error in
                print("Failed to join: \(error)")
            }
        )
    }

    func publishLocalStream() {
        AuviousConferenceSDK.sharedInstance.startPublishLocalStreamFlow(type: .micAndCam)
    }

    func leaveConference() {
        AuviousConferenceSDK.sharedInstance.leaveConference(
            conferenceId: "<conference-name>",
            onSuccess: { },
            onFailure: { _ in }
        )
    }

    // MARK: - AuviousSDKConferenceDelegate

    func auviousSDK(didReceiveLocalVideoTrack localVideoTrack: RTCVideoTrack!) {
        // Render the local video track in your UI
    }

    func auviousSDK(didReceiveRemoteStream stream: RTCMediaStream, streamId: String,
                    endpointId: String, type: StreamType) {
        // Render the incoming remote stream in your UI
    }

    func auviousSDK(didReceiveLocalStream stream: RTCMediaStream, streamId: String,
                    type: StreamType) {
        // Local stream is ready
    }

    func auviousSDK(onError error: AuviousSDKError) {
        print("SDK error: \(error)")
    }

    func auviousSDK(didChangeState newState: StreamEventState, streamId: String,
                    streamType: StreamType, endpointId: String) {
        // React to stream state transitions (connecting, connected, disconnected, etc.)
    }

    func auviousSDK(trackMuted type: StreamType, endpointId: String) { }
    func auviousSDK(trackUnmuted type: StreamType, endpointId: String) { }
    func auviousSDK(conferenceOnHold flag: Bool) { }
    func auviousSDK(didReceiveConferenceEvent event: ConferenceEvent) { }
    func auviousSDK(didRejoinConference conference: ConferenceSimpleView) { }
    func auviousSDK(recorderStateChanged toActive: Bool) { }
    func auviousSDK(agentPortraitMode flag: Bool, endpointId: String) { }
    func auviousSDK(screenSharingStarted: Bool) { }
    func auviousSDK(screenSharingStopped: Bool) { }
    func auviousSDK(didResumeFromBackground withActiveAudio: Bool) { }
}

Configuration Options Reference

AuviousConferenceConfiguration

Used when presenting AuviousConferenceVCNew for the built-in conference UI.

Authentication & Connection

Property Type Description
username String Username (or ticket) used to authenticate with the Auvious platform.
password String Password used to authenticate.
grantType String OAuth grant type. Default: "password".
clientId String Client identifier registered on the Auvious platform. Default: "customer"
conference String Name of the conference room to join or create.
baseEndpoint String Base URL of the Auvious API (e.g. "https://auvious.video/").
mqttEndpoint String Hostname of the MQTT WebSocket broker (e.g. "auvious.video").

Call Behaviour

Property Type Default Description
callMode AuviousCallMode .audioVideo Stream mode for the call. Use .audio for audio-only, .video for video-only, or .audioVideo for both.
enableSpeaker Bool true Route audio to the loudspeaker on join.
backgroundAudioEnabled Bool false Keep audio running when the app moves to the background. Requires the audio UIBackgroundMode in Info.plist.
participantName String? nil Optional display name shown to other participants.

UI Controls

Property Type Default Description
conferenceBackgroundColor UIColor .darkGray Background colour of the conference view.
cameraAvailable Bool true Show the camera toggle button.
microphoneAvailable Bool true Show the microphone mute/unmute button.
speakerAvailable Bool true Show the speaker toggle button.
pipAvailable Bool true Show the Picture-in-Picture button.
screenSharingAvailable Bool true Show the screen-sharing button.

AuviousConferenceSDK — Key Properties

Property Type Description
delegate AuviousSDKConferenceDelegate? Receives stream, state, and error events.
publishVideoResolution PublishVideoResolution Video quality for the outgoing stream. .min (640×480), .mid (960×720), .max (1920×1080).
isLoggedIn Bool Whether the SDK is currently authenticated. Read-only.
userEndpointId String? The current user's endpoint identifier. Read-only.

Enumerations

AuviousCallMode

Value Description
.audio Audio-only call.
.video Video-only call.
.audioVideo Audio and video call.

StreamType

Value Description
.mic Audio stream only.
.cam Video stream only.
.micAndCam Audio and video stream.
.screen Screen-sharing stream.

PublishVideoResolution

Value Resolution
.min 640 × 480
.mid 960 × 720
.max 1920 × 1080

AuviousSDKGenericError

Value Description
.AUTHENTICATION_FAILURE Credentials were rejected by the platform.
.PERMISSION_REQUIRED Camera or microphone permission was denied by the user.
.NETWORK_ERROR A network-level failure occurred.
.CALL_REJECTED The call was rejected by the remote party.
.CONFERENCE_MISSING The specified conference room does not exist.
.INVALID_TICKET(ticketId) The provided ticket is invalid or expired.
.UNKNOWN_FAILURE An unexpected error occurred.

Examples

The following example applications are included in this repository. If unsure, begin with ExampleSimpleConference, which demonstrates how to use a ready-to-use ViewController we provide, for joining a video conference call.

To try the above examples you should open the Example/AuviousSDK.xcworkspace in Xcode.

There is also a separate repository with examples available at https://github.com/auvious/ios-examples. At the current moment the following examples are available there:

  • SimpleConference Similar to ExampleSimpleConference written in SwiftUI.
  • GenesysCloudSimpleConference Demonstrates how to quickly add video call capability to your iOS application, utilizing Genesys Cloud webChat channel for ACD routing.

Publish version

Follow the steps below to publish a new version

Publish to git

Increase the version in AuviousSDK.podspec

Tag git with the version (ex 1.2.0)

Push the version and the tag to github

Publish Pod

If this is the first time you do this process in your machine, you need to have cocoapods installed. Follow the instructions in http://cocoapods.org on how to install it in your machine.

Once you have the pod command ready, add the auvious podspec repo to your pod repos by running this command. This will add a repo that requires SSH authentication so be sure that you have setup an SSH key with gitHub.

pod repo add <your-pod-name> git@github.com:auvious/CocoaPodSpecs.git

Example:

pod repo add auvious-cocoa-pod git@github.com:auvious/CocoaPodSpecs.git

Next you need to push to that repo

pod repo push <your-pod-name> AuviousSDK.podspec --verbose --allow-warnings

Example:

pod repo push auvious-cocoa-pod AuviousSDK.podspec --verbose --allow-warnings

Release notes

1.4.0

  • Feature / screen sharing. Only works within app
  • Feature / Picture in Picture. Can work as standalone or while screen sharing
  • Feature / Support background audio. If app is in background, call continues with audio only
  • Feature / add 'user-agent' to headers to track usage
  • Feature / 3 dots menu (more) if more than 4 actions are available
  • Bug fix / If recording started before app joins the call, the indicator was not shown
  • Bug fix / Use icon instead of 'audio only' if camera is off
  • Bug fix / MQTT Fails if wrong ticket is used
  • Bug fix / if agent changes from MIC to MIC_AND_CAM while PiP, app crashed
  • Bug fix / Add participant and stream metadata when joining the call
  • Bug fix / Do not rejoin conference if notification center is shown

1.3.1

  • Feature / Added support for portrait mode
  • Feature / Changed the remote stream aspect ratio closer to 4:3

1.3.0

  • Feature / Option to show/hide mic, camera and speaker buttons
  • Feature / Option to change background color in conference view
  • Feature / Option to output audio directly to speaker

1.2.1

  • Feature / Show notifications and indicator when recordring starts / stops

1.2.0

  • Feature / Simple confernce can now start with either mic, cam or both

1.1.1

  • Feature / Updated assets

1.1.0

  • Bug fix / MTQTT / RabbitMQ security updates

1.0.9

  • Feature / Network indicator
  • Bug fix / Join a call that is already on hold
  • Bug fix / Logout even if a leaveConference fails

1.0.8

  • Feature / Support multiple stun/turn urls

1.0.7

  • Feature / Changed GoogleWebRTC to internal custom build
  • Feature / Support dark mode for iOS 13

1.0.6

  • Feature / Added high-res icons

1.0.1

  • Bug fix / MQTT fixes

1.0.0

  • Feature / Support for audio/cam/video call
  • Feature / Layout to support up to 6 participants
  • Feature / Layout to support remote desktop capture stream

Author

Auvious, team@auvious.com

License

AuviousSDK is available under the MIT license. See the LICENSE file for more info.

About

Auvious iOS SDK repo

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages