Project setup
BPK SmartLib is available off-the-shelf for numerous platforms and video players. Apple & Android ecosystems are of course supported but the lib also runs on web browsers, set-top-boxes or Smart TVs. Pre-packages versions of BPK SmartLib are available for the most popular video players and a generic API version is also available for players not supported yet. It is available in a variety of programming languages including Objective-C, Java, JavaScript.
To get started, you can grab a lib package depending on the platform you are running:
Android | iOS & tvOS | Web | |
|---|---|---|---|
| Platform | Android smartphone Android tablet Android TV | iPhone iPad Apple TV | Browser Smart TV STB React Native Other JavaScript platforms |
| Download method | Gradle | CocoaPods or SPM | NPM or JS files |
| Current version | ... | ... | ... |
In this guide, you can select With player or Without player above code samples depending on the integration you need:
- For an Analytics integration, Analytics only integration or Ad insertion integration, select With player.
- For a Broadpeak CDN integration or other optional player metrics integration, select Without player.
Please refer to Getting started for more info.
Android
The easiest way to get the BPK SmartLib is to add it as a Gradle dependency. We assume you are using Android Studio with the latest tools updates as recommended by Google.
First, add our repository to your settings.gradle:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven {
url "https://delivery-platform.broadpeak.tv/android/repository/all"
}
}
}
Since the version 04.02.04.1f725a1, the maven repository URL has changed. Please update your configuration in your gradle files.
If you need an older version, please ask Broadpeak.
Next, add the BPK SmartLib dependency to the build.gradle file of your app module:
- With player
- Without player
implementation 'tv.broadpeak.smartlib:smartlib-true:...'
implementation 'tv.broadpeak.smartlib:smartlib-generic:...'
iOS & tvOS
The iOS & tvOS library can be downloaded:
- using SPM (Swift Package Manager) : install the lib through Xcode in Swift or Objective-C projects
- using CocoaPods : install the lib with a Pod file and CocoaPods commands
- Xcode 13.0 or higher
- iOS deployment target 15.0 or higher
- tvOS deployment target 15.0 or higher
Using SPM
On Xcode, open the Project and Targets settings. Select your project and go to the Package Dependencies tab.
Click +, and enter the following URL in Search or Enter Package URL:
https://delivery-platform.broadpeak.tv/ios/broadpeak/smartlib-package.git
Once resolved, select smartlib-package. Then, in Dependency rule, pick Up to Next Major Version.
Click Add Package and select the player you need.
-
Use SmartLib-Generic if you don't need a player integration.
-
The SPM package works on both iOS and tvOS platforms excepted for Labgency that is only available on iOS.
Using CocoaPods
Specify this in your Podfile:
- With player
- Without player
source 'https://cdn.cocoapods.org/'
source 'https://delivery-platform.broadpeak.tv/ios/broadpeak/specs.git'
target 'your target name' do
use_frameworks!
# iOS dependency
pod 'SmartLib-v3/Generic', '...'
# tvOS dependency
pod 'SmartLib-v3/Generic+tvOS', '...'
end
source 'https://cdn.cocoapods.org/'
source 'https://delivery-platform.broadpeak.tv/ios/broadpeak/specs.git'
target 'your target name' do
use_frameworks!
# iOS dependency
pod 'SmartLib-v3/Generic', '...'
# tvOS dependency
pod 'SmartLib-v3/Generic+tvOS', '...'
end
Then, you will need to add our repository and install pods:
pod repo add broadpeak https://delivery-platform.broadpeak.tv/ios/broadpeak/specs.git
pod install
You can now open your project with the xcworkspace file.