Getting started on iOS
How to use the THEOlive SDK in your iOS app.
Add dependency using CocoaPods
- Create a Podfile if you don't already have one. From the root of your project directory, run the following command:
pod init
- Add
THEOliveSDK
as a dependency in your Podfile:pod 'THEOliveSDK', '1.0.0'
- Install the pods using
pod install
, then open your.xcworkspace
file to see the project in Xcode.
Embedding a player in your app
Import the SDK
import THEOliveSDK
Create a THEOlivePlayer
let player = THEOlivePlayer()
Create a view controller for the player using
let playerViewController = THEOlivePlayerViewController(player: player)
Then embed this view controller in one of your own view controllers
let yourViewController = UIViewController(nibName: nil, bundle: nil)
yourViewController.addChild(playerViewController)
yourViewController.view.addSubview(playerViewController.view)
playerViewController.didMove(toParent: yourViewController)
Controlling your player
To control the player use the player
property of the THEOlivePlayerViewController
. For more information of the player API see you can download the API documentation here: THEOliveSDK-1.0.0.doccarchive.zip
Examples
For sample Xcode projects see https://github.com/theoplayer/theolive-ios-samples.
Updated about 2 months ago