logo
SDKs
IntroductionHow to update a SDK?
Web
Getting started with the Web SDK (Extended)Getting started with the Web SDKAPI examplesHow to implement Keyboard HotkeysHow to embed an iframe?How to implement a seamless transition between videos?How can I use video inside THEOplayer?How to work around browser cache with a new license?How to customise quality selection & labels (MP4)How to get frame-accurate currentTime display in the UI Control bar
Android
Getting started with the Android SDKAndroid SDK customizationAndroid SDK product flavorsHow to couple the native MediaRouteButton to THEOplayerHow to enable -experimental- native rendering on AndroidHow to do offline Playback with AES-128 Encrypted Streams on Android
iOS
Getting started with the iOS SDKiOS SDK CustomizationMy app does not want to build for the app storeHow to bypass copy() not working in Safari consoleHow to couple the native GCKUICastButton to THEOplayeriOS SDK Touch-events (gestures)Building for iOS Simulator, but the linked and embedded framework THEOplayerSDK.framework was built for iOS + iOS SimulatorHow to implement custom local network access (LNA) interstitial dialog for Chromecast
Android TV
Getting started with the Android TV SDK
tvOS
Getting started with the tvOS SDK
Chromecast
Getting started with the Chromecast SDKChromecast Application Customization
Webos
Getting Started with THEOplayer on WebOS
Tizen
Getting started with the Tizen SDKInstalling the Tizen developer toolsSetting up a Tizen device for debuggingDeploying a test app on a physical Tizen deviceDeploying a test app on a Tizen emulator
Roku
Getting Started with Roku SDK
Fire tv
Getting started with the Fire TV SDK
Frameworks

Getting started with the tvOS SDK

The THEOplayer tvOS SDK can be used from within both a client-server app project (TVML) or a traditional app project.

A sample traditional app project is located at https://github.com/THEOplayer/samples-tvos-sdk/.

info Cocoapods

THEOplayer v2.83.0 and above can be managed through Cocoapods. Refer to https://github.com/THEOplayer/theoplayer-sdk-ios for more information.

Prerequisites

  • Download and install Xcode.
  • Obtain a THEOplayer tvOS SDK through the THEOplayer Developer Portal at https://portal.theoplayer.com.

    • And have the license string handy, as depicted in the screenshot below, because you'll need it when configuring your video player to swap out your_license_string.

Getting started with a Client-Server App (TVML)

  1. In the target's General tab, in the Embedded Binaries click (+) and select the THEOplayerSDK.framework
  2. import THEOplayerSDK
  3. Declare a player variable, pass the TVApplicationController instance, and a license

    var playerConfig = THEOplayerConfiguration(
       license: "your_license_string"
    )
    var theoplayer = THEOplayer(appController: appController, configuration: playerConfig)
  4. Position and size your player

    theoplayer.frame = CGRect(x: 0, y: 0, width: 1280, height: 720)
  5. Add the player to your controller's view hierarchy

    theoplayer.addAsSubview(of: controller.view)

Getting started with a Traditional App

  1. In the target's General tab, in the Embedded Binaries click (+) and select the THEOplayerSDK.framework
  2. import THEOplayerSDK
  3. Prepare THEOplayer before instantiating it with your view controller, e.g. in the AppDelegate's application(_:didFinishLaunchingWithOptions:) method.

    THEOplayer.prepare(withFirstViewController: UIStoryboard(name: "Main", bundle: nil).instantiateInitialViewController())
  4. Declare a player variable with a frame and a license

    var playerConfig = THEOplayerConfiguration(
       license: "your_license_string"
    )
    var theoplayer = THEOplayer(with: CGRect(x: 0, y: 0, width: 1280, height: 720), configuration: playerConfig)
  5. Add the player to your controller's view hierarchy

    theoplayer.addAsSubview(of: controller.view)

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: "https://www.examples.com/index.m3u8", 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)
github
Make sure to follow us on GitHub!
THEO-logo-white
twitter
facebook
linkedin
Copyright © 2020. All Rights Reserved.
Leuven
New York
Singapore
Barcelona