Skip to content

Instantly share code, notes, and snippets.

@navi25
Created February 25, 2019 14:39
Show Gist options
  • Save navi25/2ce32bd67adaaa5cfa933fbb55a4f000 to your computer and use it in GitHub Desktop.
Save navi25/2ce32bd67adaaa5cfa933fbb55a4f000 to your computer and use it in GitHub Desktop.
A simple preparation for exoplayer
//Build MediaSource for one video and prepare player
private fun preparePlayer(uri: Uri){
val mediaSource = MediaSourceBuilder().build(uri)
player?.prepare(mediaSource, true, false)
}
//Overloaded function to build MediaSource for whole playlist and prepare player
private fun preparePlayer(uriList: Array<Uri>){
val mediaSource = MediaSourceBuilder().build(uriList)
player?.prepare(mediaSource, true, false)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment