Skip to content
This repository has been archived by the owner on Mar 15, 2024. It is now read-only.

Cross-Platform Extras (CPE) Manifest NextGen Extras Experience on iOS

License

Notifications You must be signed in to change notification settings

aetherinc/cpe-manifest-ios-experience

 
 

Repository files navigation

CPEExperience

An enhanced 'extras' experience around user owned content, built for iOS in accordance with a variety of MovieLabs Specifications & Standards. This reference library is built to allow implementators to accelerate their Cross-Platform Extras iOS implementation.

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate CPEExperience into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

target '<Your Target Name>' do
    pod 'CPEExperience', '~> 4.1'
end

Then, run the following command:

$ pod install

Setup

Notifications

Add the following notifications that will surface AppDelegate method calls to the CPEExperience library:

func applicationWillEnterForeground(_ application: UIApplication) {
    NotificationCenter.default.post(name: .applicationWillEnterForeground, object: nil)
}

func applicationWillResignActive(_ application: UIApplication) {
    NotificationCenter.default.post(name: .applicationWillResignActive, object: nil)
}

Delegates

Implement the ExperienceDelegate interface on any of your base applications' classes and add the required methods:

// Connection status
func connectionStatusChanged(status: ConnectionStatus)

// Experience status
func experienceWillOpen()
func experienceWillClose()
func experienceWillEnterDebugMode()

// Preview mode callbacks
func previewModeShouldLaunchBuy()

// Video Player callbacks
func interstitialShouldPlayMultipleTimes() -> Bool
func playbackAsset(withURL url: URL, title: String?, imageURL: URL?, forMode mode: VideoPlayerMode, completion: @escaping (PlaybackAsset) -> Void)
func didFinishPlayingAsset(_ playbackAsset: PlaybackAsset, mode: VideoPlayerMode)

// Sharing callbacks
func urlForSharedContent(id: String, type: SharedContentType, completion: @escaping (_ url: URL?) -> Void)

// Talent callbacks
func didTapFilmography(forTitle title: String, fromViewController viewController: UIViewController)

// Analytics
func logAnalyticsEvent(_ event: AnalyticsEvent, action: AnalyticsAction, itemId: String?, itemName: String?)

See the InputViewController class in the example project for an example of this implementation.

Chromecast

If you will be supporting Google Chromecast playback from the video player, please add the following initialization call to your base application, preferrably in the AppDelegate's application:didFinishLaunchingWithOptions: method, replacing the parameter with your Chromecast application ID:

CastManager.sharedInstance.start(withReceiverAppID: "x")

Example Project Usage

Open Example/CPEExperienceExampleWorkspace.xcworkspace in Xcode to build and run the sample project, which contains a reference to the required calls and delegate hooks to integrate the Cross-Platform Extras Experience into your video platform.

About

Cross-Platform Extras (CPE) Manifest NextGen Extras Experience on iOS

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 78.2%
  • Objective-C 21.3%
  • Other 0.5%