Skip to content

Get Started with Antourage Viewer iOS SDK

Pre-requisites

For a successful integration please find our requirements below and make sure that you are compatible:

  • Xcode 12.5 or later
  • CocoaPods 1.10.0 or later
  • Project must target iOS 13.0 or later

Install

The Antourage SDK for iOS is available as a CocoaPods pod. CocoaPods is an open source dependency manager for Swift and Objective-C Cocoa projects. If you don't already have the CocoaPods installed, see the CocoaPods Getting Started guide.

  1. Create a Podfile if you don't already have one:

    cd your-project-directory
    
    pod init
    

  2. Add the Antourage pod to your Podfile:

    platform :ios, '13.0'
    
    pod 'Antourage'
    

  3. Install the pods:
    pod install
    

Initialization

  1. Import the Antourage module in your AppDelegate:

    import AntourageViewer
    

  2. Configure an Antourage shared instance, usually in your app's application(_:didFinishLaunchingWithOptions:) method:

    Antourage.shared.configure(teamID: <teamID>, localization: <localization>)
    

Parameters

  • teamID - The 'ID' that has been assigned to the partner. This 'ID' can be requested from the Antourage partner's account manager.
  • localization - The preferred locale (e.g. "en-US") in which portal should be displayed. If not specified application locale will be used. If locale not supported English will be used.

Add UI part

The main feature of Antourage SDK is the widget — a simple button that should be placed on your screen. The widget will work only after successful configuration.

import AntourageViewer

class ViewController: UIViewController {
    private var widget: Widget = {
        let widget = Widget()
        widget.translatesAutoresizingMaskIntoConstraints = false
        return widget
    }()

    override func viewDidLoad() {
        super.viewDidLoad()

        view.addSubview(widget)
        NSLayoutConstraint.activate([
            widget.trailingAnchor.constraint(equalTo: trailingAnchor),
            widget.bottomAnchor.constraint(equalTo: safeAreaLayoutGuide.bottomAnchor, constant: 8)
        ])
    }
}

Widget's properties

  • portalColor - The color of the portal.
  • nameTextColor - The text color of the content creator or show name label.
  • nameBackgroundColor - The background color of the content creator or show name label.
  • titleTextColor - The text color of the stream name label.
  • titleBackgroundColor - The background color of the stream name label.
  • ctaTextColor - The text color of the call to action button.
  • ctaBackgroundColor - The background color of the call to action button.
  • liveDotColor - The color of the pulsating dot, which is displayed when the content is live.

Push Notifications

Subscription

Subscription and unsubscription is handled by our partners, not by the Antourage dev team. If any of our partners have push notification implemented in their system, they should provide us with the POST endpoint. Antourage backend services will send the following JSON payload to this endpoint:

{
    "title": "some title",
    "body": "some body",
    "video_url": "some url",
    "source": "antourage"
}

Sending notifications

Antourage backend will sends POST request only if new content is available. Sending push notifications is handled by our partners infrastructure.

Handling notifications

By tapping on a Push Notification from Antourage the application should open video_url in web browser:

import Antourage

func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
    let userInfo = response.notification.request.content.userInfo
    if let category = userInfo["category"] as? String, category == "antourage",
       let urlString = userInfo["video_url"] as? String, let url = URL(string: urlString) {
            UIApplication.shared.open(url)
    }
}