iOS SDK Setup

This page shows how to get THEOplayer running on iOS apps.

Objectives

  • Create a new iOS project
  • Configure THEOplayer SDK framework
  • Develop an app that uses the SDK

Before you begin

  • Make sure you have a valid THEOplayerSDK.framework

Creating a new iOS project

Steps for creating a new project

  • Create new project (cmd + shift + n)
  • Select Single View App, click 'next'
  • Enter project details, click 'next'

After selecting the directory location, you should see something similar to the screenshot below

Screen_Shot_2018-08-01_at_15.08.38.png

Configure THEOplayer SDK framework

Steps for adding a framework

  • Open finder and add your THEOplayerSDK.framework to the project directory

screenshot2.png

  • Go to the project configuration (1), select the General tab (2), and finally scroll down to the Embedded Binaries section and click '+' (3)

Screen_Shot_2018-08-01_at_15.17.44.png

  • A submenu will open, click 'Add Other...'
  • Select the previously added THEOplayerSDK.framework
  • A menu will open. They have sufficient defaults. Click 'Finish'

Screen_Shot_2018-08-01_at_15.21.48.png

Validate that the framework will correctly be added during builds

  • Go to the Build Phases tab in the project configuration, go to the Embed Frameworks section
  • Check that the THEOplayerSDK.framework is present

Screen_Shot_2018-08-01_at_16.20.19.png

Develop the app using the THEOplayer SDK

Steps for a minimal app using THEOplayer

  • Open the ViewController
  • Import THEOplayerSDK
  • Setup a player during viewDidLoad(), it is important to keep a reference to this instance
  • Set a source on the player

The result is the following snippet:

Steps for adding and removing event listeners

  • Use the THEOplayer API to add an eventlistener
  • Add var listeners : [String: EventListener] = [:] to ViewController
  • Use the THEOplayer API to add an event listener and handler
  • Add attachEventListeners() to the setup of THEOplayer

The result is the following snippet:

Validate that the tutorial was completed succesfully

  • Run the application, you can boot a similator or use your own device
  • Click the big play button