Android: Exoplayer - ExtractorMediaSource is deprecated

Viewed 15061

I am following this tutorial to implement the Exoplayer. But the ExtractorMediaSource class is deprecated. I need to play video from a remote url. What is the alternative to use in this situation?

val mediaSource = ExtractorMediaSource
  .Factory(DefaultDataSourceFactory(context, userAgent))
  .setExtractorsFactory(DefaultExtractorsFactory())
  .createMediaSource(Uri.parse(url))
2 Answers

Are you using ExoPlayer of version 2.10.0 or higher? Then, use ProgressiveMediaSource instead of ExtractorMediaSource (Reference Release Note)

ExtractorMediaSource is deprecated.ProgressiveMediaSource is updated source factory

ProgressiveMediaSource.Factory(DefaultHttpDataSource.Factory())
                .createMediaSource(MediaItem.fromUri(Uri.parse("url or path")))
Related