Skip to content

Instantly share code, notes, and snippets.

@prateek54
Created March 24, 2023 20:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prateek54/c9c92e8420c112945fd394768e74775b to your computer and use it in GitHub Desktop.
Save prateek54/c9c92e8420c112945fd394768e74775b to your computer and use it in GitHub Desktop.
Init Block to play offline downloaded video
ExoPlayer player = ExoPlayer.Builder(this).build()
player?.playWhenReady = true
val mediaSource = downloadTracker?.getDownloadRequest(Uri.parse(VIDEO_URL))!!.let {
DownloadHelper.createMediaSource(
it,
DemoUtil.getDataSourceFactory(this)
)
}
player?.setMediaSource(mediaSource)
player?.prepare()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment