Skip to content

Latest commit

 

History

History
110 lines (80 loc) · 2.97 KB

README.md

File metadata and controls

110 lines (80 loc) · 2.97 KB

android-enhanced-video-player

CI Android Enhanced Video Player

Enhanced Video Player for Android built on top of Exoplayer compliant with Android Jetpack Compose

Table of Contents

Installation

  1. Add it in your root build.gradle at the end of repositories:
allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}
  1. Add the dependency
dependencies {
	implementation 'com.github.profusion:android-enhanced-video-player:Tag'
}

Media Types

Exoplayer supports the three main adaptive streaming algorithms: HLS, DASH and MSS. However, this project does not add the modules responsible for that in the library module so we can lower the size of the distributed package.

Any apps that import EnhancedVideoPlayer can still play URIs from adaptive streaming algorithms. To do that, one can import the necessary module's on the app's build.gradle as described below.

HLS

Add the following module to the app's build.gradle

implementation "androidx.media3:media3-exoplayer-hls:$mediaVersion"

When creating the MediaItem, simply pass the HLS URI

EnhancedVideoPlayer(
  mediaItem = MediaItem.fromUri(
    "https://demo-streaming.gcdn.co/videos/676_YJHUNNocCsrjiCDx/master.m3u8"
  )
)

DASH

Add the following module to the app's build.gradle

implementation "androidx.media3:media3-exoplayer-dash:$mediaVersion"

When creating the MediaItem you can simply pass the URI if it ends with .mpd or you can pass MimeTypes.APPLICATION_MPD to setMimeType of MediaItem.Builder

val mediaItem = MediaItem.Builder()
        .setMimeType(MimeTypes.APPLICATION_MPD)
        .setUri(SOME_URI)
        .build()

EnhancedVideoPlayer(mediaItem = mediaItem)

MSS/SmoothStreaming

Add the following module to the app's build.gradle

implementation "androidx.media3:media3-exoplayer-smoothstreaming:$mediaVersion"

When creating the MediaItem you can simply pass the URI if it ends with .ism/Manifest or you can pass MimeTypes.APPLICATION_SS to setMimeType of MediaItem.Builder

val mediaItem = MediaItem.Builder()
        .setMimeType(MimeTypes.APPLICATION_SS)
        .setUri(SOME_URI)
        .build()

EnhancedVideoPlayer(mediaItem = mediaItem)

Documentation