androidkotlinexoplayerexoplayer2.x

SimpleExoPlayer.Builder(this).build() deprecated


I'm using Exoplayer in my app and initializing exoplayer as

player = SimpleExoPlayer.Builder(this).build()

But Android Studio is giving me warning as it is deprecated. When I get to the lower version of Exoplayer 2.15.1, then warning goes off. But in latest version 2.16.0, it is giving deprecation warning. How can we initialize exoplayer now with the latest version?


Solution

  • SimpleExoPlayer Deprecated. All functionality has been moved to ExoPlayer instead. ExoPlayer.Builder can be used instead of SimpleExoPlayer.Builder.

    Initialize your exoplayer as

    player = ExoPlayer.Builder(this).build()
    

    You can check the changes done in library for version 2.16.0 in release notes