Add the SDK (FireTV)
Add the SDK to your Android app or Fire TV project.
To add JWP's video experience to your app or Fire TV, you must import the JWP Android SDK (app) or JWP Fire TV SDK (Fire TV) and then configure your project.
You can download either SDK using the Gradle or Local approaches listed below.
Approach | Notes |
---|---|
Gradle (Recommended) | β’ Gradle will download the SDKβs core and optional modules for you. β’ ProGuard is automatically configured. β’ An existing app is required. |
Local | β’ The JWP Android or Fire TV SDK must be downloaded and unzipped. β’ Core and optional modules must be imported manually. β’ ProGuard must be configured. β’ An existing app is required. |
If you have any problems completing any of these tasks and have a valid JWP license, please log a support ticket for assistance.
Gradle
Import the Android or Fire TV SDK into your project with Gradle.
- From within Android Studio, open your app.
- In the project build.gradle file, add the JWP Maven repository.
allprojects {
repositories {
...
maven {
url 'https://mvn.jwplayer.com/content/repositories/releases/'
}
}
}
allprojects {
repositories {
...
maven {
url 'https://mvn.jwplayer.com/content/repositories/fireos/'
}
}
}
- In the app build.gradle file:
- Add the dependencies. When prompted by Android Studio, update the dependency versions.
- Configure
compileOptions
to support Java 8 language support.
ext.jwPlayerVersion = '4.0.0'
ext.exoplayerVersion = '2.14.0'
dependencies {
...
// JWP SDK
implementation "com.jwplayer:jwplayer-core:$jwPlayerVersion"
implementation "com.jwplayer:jwplayer-common:$jwPlayerVersion"
...
}
ext.exoplayerVersion = '2.14.0'
dependencies {
...
// JWP FireTV SDK
ext.fireTvSdkVersion = '2.0.0'
implementation "com.jwplayer:jwplayer-core:$fireTvSdkVersion"
implementation "com.jwplayer:jwplayer-common:$fireTvSdkVersion"
...
// your appβs other dependencies
}
android {
defaultConfig {
...
minSdkVersion 21
multiDexEnabled true
}
...
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
}
- In the gradle.properties file, set
android.useAndroidX
andandroid.enableJetifier
totrue
. These plugin files enable you to use androidx-namespaced libraries in your project.If you are using a current version of Android Studio, the gradle.properties file should already contain these settings.
# Project-wide Gradle settings.
android.useAndroidX=true
android.enableJetifier=true
- Sync Gradle.
You have imported the JWP Android or Fire TV SDK into your project. You can now configure ProGuard and configure the manifest.
Local
Download the SDK .zip file
- On your Players page under FireTV, click Downloads. The Android SDK Downloads panel opens.
If you have more than one property in your account, select the property from the dropdown menu at the top of the page. Each property has a unique set of license keys.
- Click the download icon for the version of the Android or Fire TV SDK that you want to download.
- On your computer, unzip the SDK .zip file.
Add the SDK dependencies
- From within Android Studio, open your app.
- Create a new directory in your app directory named libs.
- Copy and paste jwplayer-core-x.x.x.aar (Android) or jwplayer-core-fireos-release.aar (Fire TV) into the libs folder.
- Copy and paste jwplayer-common-x.x.x.aar (Android) or jwplayer-common-fireos-release.aar (Fire TV) into the libs folder.
Complete app and project configurations
- In the app build.gradle file:
- Add the dependencies. When prompted by Android Studio, update the dependency versions.
- Configure
compileOptions
to support Java 8 language support.
ext.exoplayerVersion = '2.14.0'
dependencies {
...
// JWP SDK classes
implementation fileTree(dir: 'libs', include: 'jwplayer-core-x.x.x.aar')
implementation fileTree(dir: 'libs', include: 'jwplayer-common:x-x.x.x.aar')
// ExoPlayer dependencies
implementation "com.google.android.exoplayer:exoplayer-core:$exoplayerVersion"
implementation "com.google.android.exoplayer:exoplayer-dash:$exoplayerVersion"
implementation "com.google.android.exoplayer:exoplayer-hls:$exoplayerVersion"
implementation "com.google.android.exoplayer:exoplayer-smoothstreaming:$exoplayerVersion"
implementation "com.google.android.exoplayer:exoplayer-ui:$exoplayerVersion"
// JWP Native UI dependencies
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'androidx.viewpager2:viewpager2:1.0.0'
implementation 'com.android.volley:volley:1.2.0'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
}
dependencies {
def EXO_PLAYER_VERSION = '2.16.1'
// JWP SDK classes
implementation fileTree(dir: 'libs', include: 'jwplayer-core-fireos-release.aar')
implementation fileTree(dir: 'libs', include: 'jwplayer-common-fireos-release.aar')
// ExoPlayer dependencies
implementation("com.google.android.exoplayer:exoplayer-common:${EXO_PLAYER_VERSION}")
implementation("com.google.android.exoplayer:exoplayer-extractor:${EXO_PLAYER_VERSION}")
implementation("com.google.android.exoplayer:exoplayer-core:${EXO_PLAYER_VERSION}")
implementation("com.google.android.exoplayer:exoplayer-dash:${EXO_PLAYER_VERSION}")
implementation("com.google.android.exoplayer:exoplayer-hls:${EXO_PLAYER_VERSION}")
implementation("com.google.android.exoplayer:exoplayer-smoothstreaming:${EXO_PLAYER_VERSION}")
implementation("com.google.android.exoplayer:exoplayer-ui:${EXO_PLAYER_VERSION}")
// JWP Native UI dependencies
implementation('com.squareup.picasso:picasso:2.71828')
implementation('com.android.volley:volley:1.2.1')
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
}
android {
defaultConfig {
...
minSdkVersion 21
multiDexEnabled true
}
...
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
}
- In the gradle.properties file, set
android.useAndroidX
andandroid.enableJetifier
totrue
. These plugin files enable you to use androidx-namespaced libraries in your project.If you are using a current version of Android Studio, the gradle.properties file should already contain these settings.
# Project-wide Gradle settings.
android.useAndroidX=true
android.enableJetifier=true
- Sync Gradle.
You have imported the JWP Android or Fire TV SDK into your project. You can now configure ProGuard and configure the manifest.
Updated about 1 year ago