Getting Started: iOS Sample Application
Was this article helpful?
A few short steps are all that's needed to setup the SDK in the popular Xcode development environment.
- The Mobile SDK for iOS itself
You can download the Mobile SDK from Ooyala Downloads. Click the appropriate version to download a zipfile of the Mobile SDK package.
- The Xcode 6 or later development environment for iOS applications and Apple iOS SDK 5 available at http://developer.apple.com/xcode/
- Log into your Backlot account and navigate to Account > Developers. In your API Key, the alphanumeric characters preceding the period (".") represent the PCODE constant to use in the tutorial. For example, if the API key is xxxxxxxxxxxxxxxxxxxxxxxxxxxx.0000, then use the first 28 characters (xxxxxxxxxxxxxxxxxxxxxxxxxxxx) for the PCODE. For details, see Your API Credentials.
- The embed code (content ID or asset ID) of a video you want to play
- Unzip the downloaded OoyalaSDK-iOS.zip file.
- Open the file OoyalaSDK-iOS/SampleApps/GettingStartedSampleApp/GettingStartedSampleApp.xcodeproj The source code is displayed in Xcode. On the upper left, switch to hierarchical view, expand ViewController, and select the ~viewDidLoad member.
On the appropriate lines, between the quotation marks for each constant or variable,
paste your provider code (pcode) and your embed code.
pertinent lines should look similar to the following
NSString * const PLAYERDOMAIN = @"http//www.ooyala.com"; NSString * const EMBED_CODE = @"your embed code here"; NSString * const PCODE = @"your pcode here"; . . . [ooyalaPlayerViewController.player setEmbedCode:@"EMBED_CODE"];
- EMBEDCODE: The identifier for one of your video assets.
- PCODE: Your Ooyala-supplied provider code
- PLAYERDOMAIN: Leave unchanged as http://www.ooyala.com. This constant works in conjunction with Syndication Controls (publishing rules) in Backlot. If you have set Internet domain restrictions on videos in Backlot (see the Backlot User Guide), the constant here can be set to one of those allowed domains. If you have not set these Syndication Controls, the constant has no effect.
- setEmbedCode() function: The embed code of the video you want to play as the argument. This function is the primary "work horse" of the SDK.
- Save your changes.
In the upper left, select iPhone 6.0 Simulator.
- In the upper left, click Run.
If you have problems viewing a video, make sure the syndication settings are set to allow iPhone and iPad devices. For more information, go to the "Publishing Rules" section of the Ooyala Backlot User Guide.
If the video drops out and the audio continues to play, you might have a low bandwidth connection. This ensures that viewers can still experience the content and is the expected behavior designed by Apple.