ExoPlayer: Google's new Android media player
This week, Google held its annual developer conference, Google I/O. While the keynote was massively focused on Android (with announcements for Android L, Android Wear, Android Auto or Android TV), it was still too short for all Android-related news. Luckily, Google provides additional sessions during I/O which yield tons of information.
During the Android Q&A (Fireside chat), ExoPlayer, the player currently used in the Youtube & Play Movies applications, was mentioned for the first time, and expected to be available « soon ». Since we, at Applidium, spend a lot of time working with multimedia, we were excited to hear more about this. Google, true to its word, released ExoPlayer yesterday. They also provided a brief introduction to the concepts involved.
What ExoPlayer is
MediaPlayer, the default Android multimedia player is very monolithic : you provide him with the path to the media you want to read (for example, an URL), and let him handle the media to the best of its possibilities. It makes for a very simple integration, but very difficult extensibility.
With MediaPlayer, all the player logic is hidden
With Jelly Bean (4.2), Android was provided with new APIs for low-level media manipulation, like MediaExtractor, MediaCodec and MediaCrypto. This means that you can now build your own media player. But, it also means that you need to build it from scratch, which can be a significant investment. Also, this limits your application to Jelly Bean (and higher) devices, which (as of June 2014) excludes 28% of potential users.
With Jelly Bean’s APIs, you have to provide the Player logic
ExoPlayer is an attempt to bridge the gap between these two extremes. It provides you with implementations for the different steps of the player logic (Networking, Buffering, Extraction, Decoding and Rendering), yet still leaves you free to swap in your own components.
This provides you with a lot of flexibility. For example, if you want to support a new format (and provide your own codec), or add DRM to protect your content, you can do so without building a whole new player from scratch.
What ExoPlayer isn’t
ExoPlayer provides only background changes. If you replace your current MediaPlayer with an ExoPlayer, the result will be undistinguishable for the user.
This also means that it brings no user-side features, such as fullscreen which would have been a nice addition.
Features
Out of the box, ExoPlayer provides support for DASH and Smooth Streaming, which are adaptive bitrate streaming techniques (meaning the quality of the video is adapted to the client’s capacities, namely bandwidth and CPU usage).
This new architecture also makes it simpler to include DRM support. The examples provided by Google show how to include support for their Widevine solution.
This demo also show how to allow the user to switch between different video and audio tracks, if you add the necessary components to your interface.
Finally, this pipeline also makes it easier to improve performance. Since you can improve each step independently, you can smooth out the bottlenecks you notice. Google claims that integrating ExoPlayer in Play Movies allowed them to reduce startup playback latency by 65% and decreasing rebuffering by 40%.
Integration
Good news is : ExoPlayer is not part of the L release ! Actually, it is not even part of the support library, but lives as its own standalone project. You can start including it to you projects right now.
It requires API level 9 (Gingerbread) or higher, which covers 99.2% of the user base.
As mentionned previously, Google offers a demo implementation on the Github page of the project. Google also updated its documentation to include ExoPlayer.
Conclusion
In the end, this low-key announcement has definitely grabbed our attention. In the coming weeks, we are going to experiment with the new available features, such as new formats, codecs, audio track switching or DRM. Since this projet has actually been in use for YouTube and Play Movies, we are not expecting anywhere near as many bugs as a newly released media player could have. Our only regret so far is that no new user-facing features have been included in this new release.
We're hiring!
We're looking for bright people. Want to be part of the mobile revolution?
Open positions