❗ Please note this project is deprecated, please see playkit 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
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 CocoaPods Installation :
The easiest way to install KalturaPlayerSDK is to use CocoaPods. To do so, simply add the following line to your Podfile
:
pod 'KalturaPlayerSDK'
##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
- Find the
KALTURAPlayerSDK.xcodeproj
from the subproject folder inFinder
, and drag it into Xcode’s Navigator tree. Alternatively, add it with Xcode’sAdd Files
File menu item.
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:
###Configure the app target to build the static library target.
- You will need to get the main project to build and link to the KALTURAPlayerSDK library.
- In the main project app’s target settings, find the
Build Phases
section. This is where you’ll configure theKALTURAPlayerSDK
target to automatically build and link to theKALTURAPlayerSDK
library. - After you’ve found the
Build Phases
section, open theTarget Dependencies
block and click the+
button. In the hierarchy presented to you, theKALTURAPlayerSDK
target from theKALTURAPlayerSDK
project should be listed. Select it and clickAdd
.
###Configure the app target to link to the static library target.
- 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 theTarget Dependencies
section, and click+
in there too. At the top of the list there should be thelibKALTURAPlayerSDK.a
static library that the main project target produces. Choose it and clickAdd
. - 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 theOther Linker Flags
line, and add-ObjC
.
###Adding Resources Bundle
- Choose the app target from the Targets section.
- Go to the
Products
folder and drag theKALTURAPlayerSDK.bundle
toCopy Bundle Resources
section.
** 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"
###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];
}
###CocoaPods support If you are using cocoapods please attach the following to your pod file:
pod 'google-cast-sdk'
###Linking to “GoogleCast.framework”
- Go to Target ->
Build Phases
->Link Binary with Library
, click the+
andAdd Other...
- Go to PlayerSDK folder and you will see that it contains
GoogleCast.framework
choose it and click -Open
_.
###CocoaPods support If you are using cocoapods please attach the following to your pod file:
pod 'Google-Mobile-Ads-SDK'
pod 'google-cast-sdk'
pod 'GoogleAds-IMA-iOS-SDK-For-AdMob', '~> 3.0.beta.16'
###Linking to GoogleInteractiveMediaAds SDK
- If you use ads you will have to download
GoogleMobileAds
from: Admob and add it to your project - In addition to the
GoogleMobileAds
you should downloadGoogleInteractiveMediaAds
from: IMA SDK, if you are going to use Admob in addition to theIMA SDK
you should add GoogleInteractiveMediaAds-GoogleIMA3ForAdMob to your project and if you are going to use onlyIMA SDK
you should add GoogleInteractiveMediaAds-GoogleIMA3 to your project. - Required frameworks for
GoogleMobileAds
:- StoreKit.framework
- EventKit.framework
- EventKitUI.framework
- CoreTelephony.framework
- MessageUI.framework
-
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](https://github.com/kaltura/player-sdk-native-ios/issues/51#issuecomment-196665327))
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