What is ExoPlayer and Which is the best player for live streaming in Android?

What is ExoPlayer and Which is the best player for live streaming in Android?

Tudip

Tudip

21 May 2020

It is common to play music and videos in live streaming in Android Apps. There are so many available options to do that are open source. Therefore it is difficult to choose one of them which is best for our requirements.

Let’s discuss choosing the best among them.

For media playing in android applications, the Android framework provides a media API called MediaPlayer which remains one of the most popular. Android framework also includes some low-level media APIs such as AudioTrack. MediaDrm,and MediaCodec.

Let us introduce you to the ExoPlayer that comes with numerous facilities and it can be your next favorite player for live streaming.

ExoPlayer

Exoplayer is developed by Google. Earlier it was used in YouTube and Google Play Movies. It is an open-source project. As it is available as a separate library, it does not come with the Android framework. The media components of the Exoplayer are built on the MediaCodec API of Android. We can simply get any new feature of the ExoPlayer by updating the library in our project.

ExoPlayer features

  • Exoplayer is designed as such as it can be customized easily. It can also be extended for supporting more features.
  • Exoplayer also provides features that are not available in the MediaPlayer of the Android framework like DASH (Dynamic adaptive streaming over HTTP), SmoothStreaming and Common Encryption.
  • Some new features are added in the ExoPlayer 2.x like DASH multi-period manifests, gapless audio playbacks and seeking in live playbacks.
  • Exoplayer supports many formats other than DASH and SmoothStreaming. It also supports some advanced features of HLS like handling of #EXT-X-DISCONTINUITY tags, the ability to seamlessly merge, concatenate and loop media.
  • As it is a library, we can use any version of the ExoPlayer as per our application requirement.
  • The traditional player features like play, pause, resume, skip, forward, rewind, and media buffering are supported.
  • Exoplayer is designed so that it can be used flexibly.

The media source, the renderers, the track selector, and the load control can be set which enhances its flexibility.

  • MediaSource is the source of the media that is going to be played. Generally, it is a stream URL or a file path. It is set when initializing the player under the ‘ExoPlayer.prepare’ method.
  • Renderers are used to render each individual component of the media.
  • TrackSelector is used to select the available tracks provided by the MediaSource.
  • LoadControl is set to control the media buffer.

Renderers, TrackSelector, and LoadControl are set when the player is created.

ExoPlayer comes with the default implementations of these components that can be used to facilitate in the common standard use-cases. One can customize the Exoplayer as per their requirement.

For example, changing the player controls as UI, changing the default behavior of playback controls, showing buffered content, etc.

What are the other alternatives

Yes, there are various successful competitors of ExoPlayer and we will discuss why they are not best.

Here are some other media frameworks that are available for live streaming:

  • Vimeo
  • Vitamio
  • LibVLC

As we discussed the features of the ExoPlayer. Now we will look at the features of other available media frameworks.

LibVLC:

In terms of flexibility, Vimeo is behind in the race. The reason for this is, the media content is stored on its server. There is an iFrame link available that is used to play the content in a web view which results in the low performance of the application.

Vitamio:

It supports the popular FFmpeg library and also comes with various features. Even though it does not have a huge fan base as it is a paid service.

LibVLC:

There are some restrictions in LibVLC. It only supports projects with NDK support.

CONs of ExoPlayer

As nothing is perfect, despite its exciting features there are also some disadvantages of the ExoPlayer.
So let us discuss some main disadvantages.

  • Lack of support for earlier than 16 Android versions
  • For audio tracks, it significantly consumes more battery than MediaPlayer.
  • For lightweight apps, it may increase some KBs to the APK size.

Conclusion

ExoPlayer is the most popular player used for live streaming nowadays. It is an open-source library that comes with numerous features.

As it is a library, we can use any version of the ExoPlayer as per our application requirement. We can simply get any new feature of the Exoplayer by updating the library in our project. There are more PROs of using the ExoPlayer compared to its CONs. And it is fully supported by Google. That might be the main reason for its impressive number of subscribers.

I hope the exciting features of the ExoPlayer is gonna impress you and will be your next favorite.

search

Blog Categories

Request a quote