#Prerequisites
In order to be successful running this sample app, you are expected to understand the following:
- An understanding of the Apple Developer ecosystem, with an understanding of building, running, and provisioning applications
- An understanding of the Core Ooyala SDK, how to configure and run simple Ooyala integrations (see https://github.com/ooyala/ios-sample-apps)
- A passing understanding of brew, git, and node
This document will explain a number of different use cases:
- How to Run the Sample Application
- How to perform simple customizations to the Sample Application
- How to perform complex modifications to the Sample Application
- How to update an existing Application with the iOS Skin
it's highly reccomended that you attempt these use cases in order, to have a complete understanding of the iOS Skin.
These will be the first steps that would allow you to run the Ooyala Skin Sample App, and should be the first thing you try
git clone https://github.com/ooyala/ios-sample-apps
open ios-sample-apps/OoyalaSkinSampleApp/OoyalaSkinSampleApp.xcodeproj
- Run the application
This will allow you to modify some of the configurations allowed by the Skin Config. For more information, check out the skin-config repo README.
- Open OoyalaSkinSampleApp.xcodeproj
- Modify skin-config/skin.json
- Re-run the application
Just like all other sample applications, you can modify the ListViewController with your own embed codes to see how your videos work. Note that your assets may require additional configuration of the application to work.
- Open OoyalaSkinSampleApp.xcodeproj
- Modify OoyalaSkinSampleApp/players/BasicTestsListViewController.m
- Re-run the application
The following will run you through linking the OoyalaSkinSDK source code to the OoyalaSkinSampleApp. This will allow you to do cool things, like modify the UI code and add your own features
At a high level - Android React Native allows you to set up a React JS server, then force your device/emulator to access that server to get up-to-date javascript.
You will need to perform a number of steps to succeed here:
The first step would be to get React Native set up and running, then to test it in the Sample App. Follow these steps to give that a shot:
Please follow the requirements section of the following site: http://facebook.github.io/react-native/docs/getting-started.html#requirements
run npm install
in the Ooyala Skin SDK
cd native-skin/sdk/react/ && npm install
run git submodule update --init
to initialize the skin-config
You need to start the react-native server to get your javascript to be applied to the sample application
cd native-skin/sdk/react/ && react-native start
To test - you can try to request http://localhost:8081/index.ios.bundle?platform=ios&dev=true and see if results come back
-
Comment out the original jsCodeLocation that points to the compiled bundle, and point it to the server that will be started by React Native
// NSURL *jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; NSURL *jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle"];
-
Run the Ooyala Skin Sample App in a Simulator
In order to run the Sample App on the device, you will need to provide a url that would be accessible by the physical hardware device (i.e. the local ip of the dev computer)
After you've tested the application using the React Native JS server, then you should connect the OoyalaSkinSDK Java Source Code to the application.
- Open OoyalaSkin.xcworkspace
- Add the OoyalaSkinSampleApp.xcodeproj into OoyalaSkin.xcworkspace
- In OoyalaSkinSampleApp Project Settings, remove existing OoyalaSkinSDK and add the Workspace version
The Skin-config may have been updated since the last release, and if you are using the OoyalaSkinSDK source code, you will have to reference the correct version of the skin-config.
Assuming you have connected the OoyalaSkinSDK to the OoyalaSkinSampleApp:
- Delete the existing 'skin-config' folder from OoyalaSkinSampleApp project
- Add the new 'skin-config' files from native-skin/skin-config
By this point, you should have a strong understanding of how the iOS Skin works, and how to manipulate it within the Ooyala Skin Sample App. Here are the steps to integrate the iOS Skin into your own application.
If you'd like to take another extra step, try following these steps to update the BasicPlaybackSampleApp as proof of the process
-
Download OoyalaSDK-iOS, which contains:
- Ooyala SDK (link binary with this library)
-
Download OoyalaSkinSDK-iOS, which contains:
- If the above site hasn't been updated yet, you can download the library here
- iOS Skin SDK (link binary with this library)
- ooyala-slick-type font (Add to bundle. Then in Info.plist, add "ooyala-slick-type.ttf" to "Fonts Provided by Application")
- Default localization files (Add to app bundle)
- Default skin-config.json (Add to app bundle)
- main.jsbundle (Add to app bundle)
-
Link JavascriptCore, Social, MessageUI, MediaAccessibility, MediaPlayer Frameworks to your binary. Also link libz.dylib/libz.tbd library.
-
In Build Settings, ensure the Other Linker Flag "-ObjC" is enabled
-
Modify your PlayerViewController to use the new OOSkinViewController
Replace the OoyalaPlayerViewController in your application to this new class. Below is an example of what this could look like
NSURL *jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; OOSkinOptions *skinOptions = [[OOSkinOptions alloc] initWithDiscoveryOptions:nil jsCodeLocation:jsCodeLocation configFileName:@"skin" overrideConfigs:nil]; self.skinController = [[OOSkinViewController alloc] initWithPlayer:ooyalaPlayer skinOptions:skinOptions parent:_videoView launchOptions:nil]; [self addChildViewController:self.skinController];
-
Double Check your app. The following is a list of all known requirements for Ooyala Skin SDK to work in your application
- Ooyala SDK
- Should be linked
- Ooyala Skin SDK
- Should be linked
- SDK Version in the Skin package's VERSION file should match the VERSION file in the Ooyala SDK
- ooyala-slick-type Font
- Should be bundled
- Should be part of Info.plist
- Localization Files (en.json, zh.json, etc.)
- Should be bundled
- skin-config.json
- Should be bundled
- main.jsbundle
- Should be bundled
- Ojbective-C code
- Should use the OOSkinViewController
- Should use main.jsbundle as the jsCodeLocaiton
- Necessary frameworks and libraries are linked
- Other Linker Flags
- Should have -ObjC
- Ooyala SDK
##Generate ipa for distribution
- Open the OoyalaSkinSampleApp, confirm that the the application plays on a physical device
- With a provisioned device connected, select OoyalaSkinSampleApp schema and the connected device in Xcode.
- From Xcode menu, choose "Product->Archive"
- From Xcode orgnizer, choose "Export"
- Select "Save for enterprise" and follow the instructions to generate ipa file.
##Build the OoyalaSkinSDK.framework
- xcodebuild -project sdk/OoyalaSkinSDK/OoyalaSkinSDK.xcodeproj/ -sdk iphonesimulator -target OoyalaSkinSDKUniversal
- find OoyalaSkinSDK.framework in sdk/OoyalaSkinSDK/build/
##Working with the events in SkinSDK You need to listen for event notifications on the SkinViewController object.
First you need to set up notification objects, as shown below. Events are enumerated in the header file Headers/OOSkinViewController.h with explanatory comments:
extern NSString *const OOSkinViewControllerFullscreenChangedNotification;
/* Fires when player goes FullScreen */