Video playback for Android made easy.
Kohii is a powerful, easy to use and extensible Video playback library. Kohii provides powerful features out of the box, including
Automatic playback | Playback continuity (Seamless fullscreen) |
---|---|
![]() |
![]() |
Add to your module's build.gradle dependencies
// Update top level build.gradle
allprojects {
repositories {
mavenCentral()
}
}
// Add these to app level build.gradle (or to module that will use Kohii)
implementation "im.ene.kohii:kohii-core:1.4.0.2017001" // core library
implementation "im.ene.kohii:kohii-exoplayer:1.4.0.2017001" // default support for ExoPlayer
implementation "com.google.android.exoplayer:exoplayer:2.17.1" // required ExoPlayer implementation.
Kohii uses Kotlin language with some Java 8 features so you will need to include the following options to your module's build.gradle:
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}
// Kotlin
// 1. Initialization in Fragment or Activity
val kohii = Kohii[this@Fragment]
kohii.register(this /* Fragment or Activity */).addBucket(this.recyclerView)
// 2. In ViewHolder or Adapter: bind the video to the PlayerView inside a child of the RecyclerView.
kohii.setUp(videoUrl).bind(playerView)
// Java
// 1. Initialization in Fragment or Activity
Kohii kohii = Kohii.get(this);
kohii.register(this).addBucket(this.recyclerView);
// 2. In ViewHolder or Adapter: bind the video to the PlayerView inside a child of the RecyclerView.
kohii.setUp(videoUrl).bind(playerView);
Kohii works on Android 4.4+ (API level 19+) and on Java 8+. It is recommended to use Kohii using Kotlin.
The core library doesn't come with any actual playback logic. Actual implementation comes with
extension libraries. The extensions require corresponding 3rd libraries: kohii-exoplayer
will
requires exoplayer
, kohii-androidx
will requires androidx.media2
.