KalturaPlayerSDK 2.6.12

KalturaPlayerSDK 2.6.12

TestsTested
LangLanguage Obj-CObjective C
License Custom
ReleasedLast Release Mar 2018

Maintained by Noam Tamim, Oren Melamed, Nilit Danan, Kaltura Open Source, Kaltura.



  • By
  • Eliza Sapir and Nissim Pardo

Player SDK Native iOS

Note: A new version of the Kaltura Player SDK (V3) will be available for beta very soon. The new SDK is fully native and introduces significant performance improvements.

If you are planning to begin a new project based on the SDK, you may want to wait for the new version.

The Kaltura player-sdk-native component enables embedding the kaltura player into native environments. This enables the full HTML5 player platform, without limitations of HTML5 video tag API in iOS platforms. Currently, for iOS this enables:

  • Inline playback with HTML controls ( disable controls during ads etc. )
  • Widevine DRM support
  • AutoPlay
  • Volume Control
  • Full player.kaltura.com feature set for themes and plugins
  • DFP IMA SDK

For a full list of native embed advantages, see the native controls table within the player toolkit basic usage guide.

The Kaltura player-sdk-native component can be embedded into both native apps, and hybrid native apps (via standard dynamic embed syntax)

Future support will include:

  • PlayReady DRM
  • Multiple stream playback
  • Offline viewing

Table of Contents

Getting Started

KalturaPlayerSDK can be added to any project (big or small) in a matter of minutes (maybe even seconds if you're super speedy). CocoaPods is fully supported.

SDK Traditional Installation :

git clone https://github.com/kaltura/player-sdk-native-ios.git

Add the static library's .xcodeproj to the app's project

  1. Find the KALTURAPlayerSDK.xcodeproj from the subproject folder in Finder, and drag it into Xcode’s Navigator tree. Alternatively, add it with Xcode’s Add Files File menu item.

alt text

Make sure to add the KALTURAPlayerSDK.xcodeproj file only, not the entire directory.
You can’t have the same project open in two different Xcode windows.If you find that you’re unable to navigate around the library project, check that you don’t have it open in another Xcode window.
After you’ve added the subproject, it should appear below the main project in the Xcode’s Navigator tree:

alt text

Configure the app target to build the static library target.

  1. You will need to get the main project to build and link to the KALTURAPlayerSDK library.
  2. In the main project app’s target settings, find the Build Phases section. This is where you’ll configure the KALTURAPlayerSDK target to automatically build and link to the KALTURAPlayerSDK library.
  3. After you’ve found the Build Phases section, open the Target Dependencies block and click the + button. In the hierarchy presented to you, the KALTURAPlayerSDK target from the KALTURAPlayerSDK project should be listed. Select it and click Add.alt text

Configure the app target to link to the static library target.

  1. You will need to set the app to link to the library when it’s built - just like you would a system framework you would want to use. Open the Link Binary With Libraries section located a bit below the Target Dependencies section, and click + in there too. At the top of the list there should be the libKALTURAPlayerSDK.a static library that the main project target produces. Choose it and click Add. alt text
  2. Because we are using Objective-C, we have to add a couple of linker flags to the main project app’s target to ensure that ObjC static libraries like ours are linked correctly. In the main project target’s Build Settings find the Other Linker Flags line, and add -ObjC.alt text

Adding Resources Bundle

  1. Choose the app target from the Targets section.
  2. Go to the Products folder and drag the KALTURAPlayerSDK.bundle to Copy Bundle Resources section.alt text

** If you click build now, you will see that the PlayerSDK library is built before the main project app, and they are linked together.**

Required Frameworks

• SystemConfiguration
• QuartzCore
• CoreMedia
• AVFoundation
• AudioToolbox
• AdSupport
• WebKit
• Social
• MediaAccessibility
• libSystem.dylib
• libz.dylib
• libstdc++.dylib
• libstdc++.6.dylib
• libstdc++.6.0.9.dylib
• libxml2.dylib
• libxml2.2.dylib
• libc++.dylib

*If you are using Xcode 7 notice that the extension "dylib" was changed to "tbd"

Using Kaltura player

To Import KPViewController to main project

#import <KALTURAPlayerSDK/KPViewController.h>

Create KPViewController instance:

@property (retain, nonatomic) KPViewController *player;

To Initialize PlayerViewController for Fullscreen:

- (KPViewController *)player {
    if (!_player) {
        // Account Params
        KPPlayerConfig *config = [[KPPlayerConfig alloc] initWithDomain:@"http://cdnapi.kaltura.com"
                                           uiConfID:@"26698911"
                                           partnerId:@"1831271"];


    // Video Entry
    config.entryId = @"1_o426d3i4";

        // Setting this property will cache the html pages in the limit size
        config.cacheSize = 100; // MB
        _player = [[KPViewController alloc] initWithConfiguration:config];
    }
    return _player;
}

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];

    [self presentViewController:self.player animated:YES completion:nil];
}

To Initialize PlayerViewController for Inline

- (KPViewController *)player {
    if (!_player) {
        // Account Params
        KPPlayerConfig *config = [[KPPlayerConfig alloc] initWithDomain:@"http://cdnapi.kaltura.com"
                                           uiConfID:@"26698911"
                                           partnerId:@"1831271"];


        // Video Entry
        config.entryId = @"1_o426d3i4";

        // Setting this property will cache the html pages in the limit size
        config.cacheSize = 0.8;
        _player = [[KPViewController alloc] initWithConfiguration:config];
    }
    return _player;
}

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    self.player.view.frame = (CGRect){0, 0, 320, 180};
    [self.player loadPlayerIntoViewController:self];
    [self.view addSubview:_player.view];
}

Linking GoogleCast

Linking to “GoogleCast.framework”

  1. Go to Target -> Build Phases -> Link Binary with Library, click the + and Add Other...
  2. Go to PlayerSDK folder and you will see that it contains GoogleCast.framework choose it and click -Open_. alt text

Linking GoogleAds

Linking to GoogleInteractiveMediaAds SDK

  1. If you use ads you will have to download GoogleMobileAds from: Admob and add it to your project
  2. In addition to the GoogleMobileAds you should download GoogleInteractiveMediaAds from: IMA SDK, if you are going to use Admob in addition to the IMA SDK you should add GoogleInteractiveMediaAds-GoogleIMA3ForAdMob to your project and if you are going to use only IMA SDK you should add GoogleInteractiveMediaAds-GoogleIMA3 to your project.
  3. Required frameworks for GoogleMobileAds:
    • StoreKit.framework
    • EventKit.framework
    • EventKitUI.framework
    • CoreTelephony.framework
    • MessageUI.framework

Troubleshooting

  • if you are using Xcode 7 you have to change the Enable Bitcode option. (see this link)

  • If you receive this output:

    WebKit discarded an uncaught exception in the webView:decidePolicyForNavigationAction:request:frame:decisionListener: delegate:

    You have to configure a Cocoa key called NSAppTransportSecurity (see this link)

License and Copyright Information

All player-sdk-native-ios code is released under the AGPLv3 unless a different license for a particular library is specified in the applicable library path