iOS SDK Setup

1. System Requirements

The THEOplayer iOS SDK can be used from within both Swift and Objective-C projects.

2. Getting Started

Using the THEOplayer iOS SDK is possible through the following steps:

  1. In the target's General tab, in the Embedded Binaries click (+) and select the THEOplayerSDK.framework
  2. Import the framework in your view controller
    import THEOplayerSDK
  3. Declare a player variable and initialize it
    var theoplayer = THEOplayer()
  4. Position and size your player
    theoplayer.frame = CGRect(x: 0, y: 0, width: 320, height: 180)
  5. Add the player to your controller's view hierarchy
    theoplayer.addAsSubview(of: controller.view)

3. Controlling the player

Once a player is created and set in your view, you can start interacting with the player instance using the THEOplayer API.

Setting a source

Create a SourceDescription object and set the player's source

let source = SourceDescription(sources: [TypedSource(src: "//", type: "application/x-mpegurl")])
theoplayer.source = source


Add a player event listener

This example shows you how to listen to the player play event.

var playListener = theoplayer.addEventListener(type: PlayerEventTypes.PLAY, listener: handlePlayEvent)

func handlePlayEvent(event : PlayEvent) {
    print("Received \(event.type) event at \(event.currentTime)")


Remove a player event listener

theoplayer.removeEventListener(type: PlayerEventTypes.PLAY, listener: playListener)