Git Product home page Git Product logo

playkit-ios-smartswitch's Introduction

PlayKitSmartSwitch

Swift 3.0+ CI Status Version License Platform

Kaltura Player iOS plugin for NPAW Smart Switch

Example

To run the example project, clone the repo, and run pod install from the Example directory. Then run iOS and tvOS samples

Installation

PlayKitSmartSwitch is available through CocoaPods. To install it, simply add the following lines to your Podfile:

pod 'PlayKitSmartSwitch'

Once you setup everything run command in the Terminal.

pod install

Usage

In the AppDelegate:

This step required only for basic PlayKit users.

import PlayKit
import PlayKitSmartSwitch

in the application(_:didFinishLaunchingWithOptions:) needs to add registration plugin to PlayKit manager:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
PlayKitManager.shared.registerPlugin(SmartSwitchMediaEntryInterceptor.self)
return true
}

Create plugin config and add it to player:

Create plugin config parameters may be different than shown on example.

import PlayKit
import KalturaPlayer
import PlayKitSmartSwitch
var kalturaOTTPlayer: KalturaOTTPlayer

let smartSwitchConfig = SmartSwitchConfig()
smartSwitchConfig.accountCode = "kalturatest" // Youbora account code.
smartSwitchConfig.originCode = "vod"
smartSwitchConfig.optionalParams = ["live": "false"]
smartSwitchConfig.timeout = 5 // Timeout time period for Youbora CDN balancer calls.
smartSwitchConfig.reportSelectedCDNCode = true // if true plugin will report chosen CDN code to Youbora analytics.
// smartSwitchUrl this is optional parameter. Set it if you have different Youbora CDN balancer host.
smartSwitchConfig.smartSwitchUrl = "http://cdnbalancer.youbora.com/orderedcdn"

// Add PluginConfig to KalturaPlayer
let playerOptions = PlayerOptions()
playerOptions.pluginConfig = PluginConfig(config: [SmartSwitchMediaEntryInterceptor.pluginName: smartSwitchConfig])

kalturaOTTPlayer = KalturaOTTPlayer(options: playerOptions)

You may need to update player with new options if needed.

kalturaOTTPlayer.updatePlayerOptions(playerOptions)

Errors handling

On the kalturaOTTPlayer object you have to subscribe to an event SmartSwitchEvent.error to recieve errors rised by plugin.

kalturaOTTPlayer.addObserver(self, events: [SmartSwitchEvent.error]) { event in
            // Handle Smart Switch error here.
            if let error = event.error {
                // error here is NSError
                print(error.localizedDescription)
            }
        }

License and Copyright Information

All code in this project is released under the AGPLv3 license unless a different license for a particular library is specified in the applicable library path.

Copyright © Kaltura Inc. All rights reserved.
Authors and contributors: See GitHub contributors list.

playkit-ios-smartswitch's People

Contributors

chausov avatar giladna avatar imberezin avatar orenme avatar

Watchers

Zohar Babin avatar iKinnrot avatar  avatar James Cloos avatar  avatar KCorpIT avatar Nilit Danan avatar  avatar Alex avatar Kaltura GitHub Hooks avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.