
Developers
Android SDK
Developers
Android SDK
This section gives an introduction to the core features of the Flowplayer Android SDK and lists all the requirements for adding the SDK in an Android Project. This guide assumes that you have basic understanding of Android development and that you are familiar with Android Studio and Gradle.
The Flowplayer Android SDK is a native media player, written entirely in Kotlin and provides an easy-to-use API which enables developers to create beautiful Android applications which play audio and video both locally and over the Internet. The Flowplayer Android SDK uses ExoPlayer in its core and therefore takes advantage of all its powerful and well-tested features. The SDK supports adaptive streaming technologies such as DASH, HLS, and SmoothStreaming, as well as the most popular single container formats, such as MP4, MP3, WebM, and several more.
Our demo application is available open source on Github and it will help you to better understand how to include the Flowplayer Android SDK in your Android project.
Some of the most important features of the Flowplayer Android SDK include but are not limited to:
In order to be able to compile and run your application using the Flowplayer Android SDK, the following few requirements need to be met.
The minimum required Android SDK version is 19. Set the minSdkVersion
in your app level module as follows:
android {
defaultConfig {
minSdkVersion 19
}
}
If your project does not use any older version of the Support Library,
then simply enable AndroidX by setting the following attributes inside your gradle.properties
file.
android.useAndroidX=true
android.enableJetifier=true
If, however, your project already uses an older version of the Support Library, then you will have to migrate to AndroidX. This can be easily achieved using Android Studio and by simply following these AndroidX migration instructions.
The Flowplayer Android SDK is written using Java 8 features.
In order to make your project compatible with Java 8, you need to configure the targetCompatibility
in your app level build.gradle
file as follows:
android {
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
}
}
Once you have met all the prerequisites, you are ready to add the Flowplayer Android SDK to your project and start developing.
First, add Flowplayer's repository in your project by setting a new maven
repository in your project level build.gradle
as follows:
allprojects {
repositories {
maven {
url 'https://dl.bintray.com/flowplayer/maven/'
}
}
}
Finally, add the SDK as a dependency in your app level build.gradle
and replace "x.x.x" with the latest version as noted below:
dependencies {
implementation 'com.flowplayer.android.player:flowplayer-core:x.x.x'
}
In your application's AndroidManifest.xml
there are two things that need to be configured.
In order to use the SDK you need to configure a player token. It's done by addding it to AndroidManifest.xml
with a <meta-data>
tag:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.flowplayer.player.demo">
<application>
<!-- other configuration -->
<meta-data
android:name="com.flowplayer.accessToken"
android:value="eyJraWQ...XOFctHrQ" />
</application>
</manifest>
Flowplayer tokens can be created and revoked from the Flowplayer Dashboard
In every <activity>
that will contain the player, add android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
in order to prevent the Activity from being destroyed on orientation changes.
<application>
<!-- Other configuration -->
<activity
android:name="com.my.package.MyAwesomePlayerActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize" />
</application>
That's it - now we are ready to initialize the player.
Live streaming
Live analytics
Ad scheduling
Monetization