Mobile SDK for tvOS
The Ooyala tvOS SDK provides basic playback for HLS and MP4 assets and supports FairPlay DRM and Ooyala analytics.
These two files supply the OoyalaTVSDK.framework and OoyalaTVSkinSDK.framework libraries.
Integrate the Ooyala tvOS SDK
- Copy OoyalaTVSDK.framework and OoyalaTVSkinSDK.framework into your library folder.
- Click Build Settings: select and .
- Click Build Phases and expand Link Binary with Libraries. Ensure the OoyalaTVSDK.framework and OoyalaTVSkinSDK.framework are linked with your application here.
- Build and run your project on a tvOS simulator or an Apple TV device.
- (Optional) To verify that you have integrated the Ooyala tvOS SDK correctly, build and run the Ooyala tvOS sample app.
The Ooyala TVOSSampleApp demonstrates how you can integrate Apple's tvOS to run applications on Apple TV devices. To try out the sample app, visit https://github.com/ooyala/ios-sample-apps/tree/stable/PlaybackLab/TVOSSampleApp.
Customize the Ooyala tvOS Player UI
- Fork https://github.com/ooyala/native-skin/tree/stable/sdk/tvOS.
- Remove the OoyalaTVSkinSDK.framework from your project.
- Add the OoyalaTVSkinSDK project that you forked into your master project.
- Modify OoyalaTVPlayerViewController to implement your custom UI features.
- (Optional) Submit a pull request.
Notes on Using the tvOS Core SDK
The Ooyala tvOS Core SDK is a direct port of the iOS Core SDK. The codebase for both SDKs is almost the same.
The tvOS Skin SDK provides a UI that was built from the ground-up specifically for the tvOS Platform. The iOS React-Native Skin SDK is not portable to tvOS because tvOS does not support react-native.
The Skin SDK is completely open-source in the native skin repo: https://github.com/ooyala/native-skin/tree/stable/sdk/tvOS. To make your own UI, fork the repo, use the Ooyala controls as a baseline, and extend the code however you like.
With the tvOS Core SDK, implementing the ViewController is significantly different from how it is done with other SDKs. Do not instantiating an OoyalaPlayer and create an OoyalaPlayerViewController as a child to the primary ViewController. Instead, extend the OOOoyalaTVPlayerViewController and segue to that new ViewController.
For example, the header file contains the following code:
#import <UIKit/UIKit.h> #import <OoyalaTVSkinSDK/OOOoyalaTVPlayerViewController.h> @interface FullscreenPlayerViewController : OOOoyalaTVPlayerViewController @end
self.pcode = self.option.pcode; self.playerDomain = self.option.domain; self.player = [[OOOoyalaPlayer alloc] initWithPcode:self.pcode domain:[[OOPlayerDomain alloc] initWithString:self.playerDomain]]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(notificationHandler:) name:nil object:self.player]; [self.player setEmbedCode:self.option.embedCode]; [self.player play];
To see more code, you can look at these sample app references on github:
Interacting with the Sample App: To interact with an Apple TV, you must use an Apple TV Remote. In Xcode, when you build and run the app in Xcode, if you run the app in an Apple TV simulator on your Mac desktop, also use.
To control the app, use the Apple TV Remote as follows:
To play or pause the video press the play/pause button, or hard-click (press) the touchpad until it depresses and clicks.
To seek forward or backward: soft-click the touchpad on either side of the remote.
While paused, to scrub forward or backward in the video, swipe left or right on the touchpad.
Avoid Using Inline Players: Although the sample app for tvOS includes one, we do not fully support "Inline Players" for the following reasons:
- Inline players create user experience issues interacting with the player.
- Apple recommends always displaying video in fullscreen.