'Android: Exoplayer - ExtractorMediaSource is deprecated

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))


Solution 1:[1]

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

Solution 2:[2]

ExtractorMediaSource is deprecated.ProgressiveMediaSource is updated source factory

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 SaadAAkash
Solution 2 Tarun A