Exploring ExoPlayer 2

ExoPlayer is an extensible, application level media player for Android apps. It’s an alternative to the high level Android MediaPlayer API. MediaPlayer is built on several low level media playing APIs like AudioTrack and MediaDRM. These low level APIs can also be used by developers to build your own media player with it’s own custom behavior. ExoPlayer is built on these low level APIs and it has the additional benefit of being open source. You don’t need to build your own media player, from scratch, to get the behavior you need. You can extend ExoPlayer instead.

ExoPlayer was created and is maintained by Google. Out of the box, it can play a wide range of audio and video formats such as:

  • MP3
  • MP4
  • WAV
  • MKV
  • MPEG-TS
  • Ogg

Remember, ExoPlayer is open source, so it can, with some extension, decode and play any format, as long as you build the capability.

Just a Few ExoPlayer Basics & Components

ExoPlayer component diagram

Source: ExoPlayer Documentation on GitHub

ExoPlayer

The ExoPlayer class is the actual media player. It depends on a few other components for media loading, buffering, decoding, and track selection. When all of the required components are configured, your app will interact with the ExoPlayer class to control the playback of your media. You can register listeners with ExoPlayer to be notified of certain events like buffering or the conclusion of a track.

MediaSource

The MediaSource class is charged with controlling what media will be played and how it will be loaded. The MediaSource class is used directly by the ExoPlayer class. MediaSource enables a ton of different behaviors. For example, you can merge multiple MediaSource classes together to show video, along with captions or you can use multiple MediaSource classes to create playlists where the transitions between those sources are seamless (gapless).

There are several prebuilt MediaSource classes available out of the box in ExoPlayer to support many common use cases like playing normal media files or streaming DASH content from a remote server. Of course, you can implement your own to support your application’s use case.

DataSource

The DataSource class provides samples of data to a MediaSource. These samples of data can originate from a file on the SD card, a resource in the assets directory, and even a remote server. You can use one of the prebuilt DataSource classes or build your own to read data in a way necessary to support your use case. For example, maybe your application will stream media on a company intranet. You can use a custom DataSource to define the rules and protocols that allow this to happen securely.

TrackSelector

The TrackSelector class dictates which track is selected for rendering and playback.

Renderer

The Renderer class decodes media and renders it. An example implementation is the MediaCodecAudioRenderer, which decodes audio data and renders it using several lower level ExoPlayer APIs.

LoadControl

The LoadControl class defines the buffering behavior of a particular MediaSource.

Finally

At this point, I know as much about ExoPlayer 2 as you do. I have some pretty extensive knowledge of ExoPlayer 1.X because I’ve used it on several Android projects that I’ve worked on. This series on ExoPlayer 2 will document my journey of learning about ExoPlayer 2 and upgrading an app to ExoPlayer 2 that is currently using ExoPlayer 1.5.9. I will probably make mistakes, but I hope this series will help a few other developers in their effort to implement ExoPlayer 2 in a real world app.

The app I will be using for demonstrating this upgrade is PremoFM. PremoFM is an open-source podcast player that I started building almost two years ago. The source code for the app is on GitHub (https://github.com/emuneee/premofm). I will be using a branch (https://github.com/emuneee/premofm/tree/exoplayer_2) for all of my ExoPlayer 2 upgrade work. I invite you to follow along. I’ll be back next week to discuss the structure of a typical audio playing app and how ExoPlayer fits in.

Please follow me on Twitter (@emuneee).

Finally, I’m working with a great team at RadioPublic to build an awesome podcast experience for Android and iOS. Hop on the beta today.

Some resources to review in the meantime:

ExoPlayer on GitHub

https://github.com/google/ExoPlayer

ExoPlayer — Developer Guide

https://google.github.io/ExoPlayer/guide.html

ExoPlayer on Medium

https://medium.com/google-exoplayer

Android Developer Backstage 48: ExoPlayer

http://androidbackstage.blogspot.com/2016/05/episode-48-exoplayer.html

PremoFM 1.2 – Introducing Pinning, OPML support, iTunes links, and more Material

web_hi_res_512

PremoFM, Android’s freshest podcast app, just leveled up with PremoFM 1.2 with a lot more awesome.  It’s available in Google Play now!

What’s new?

Pinning allows you save episodes to your device without subscribing to the podcast.  Want to check out Tim Ferriss Podcast w/ Jamie Foxx, but don’t want to subscribe?  Pin that episode to your device and you can listen to it, download it, add it to a collection or playlist.  Remove it when you’re done with it.

OPML Support allows you to import all of your podcasts from another podcast player, into PremoFM.  You can also export all of your PremoFM podcast subscriptions to an OPML file.  Access both features in settings.

iTunes Podcast Link opening allow you to click on an iTunes podcast link and open it in PremoFM, to that specific podcast.  Most podcasts list their iTunes link directly on their landing page.  This allows you to subscribe to podcast from the web on your Android phone more seamless.

Notifications have been improved.  Not only are they more readable, but now you’ll be able to check out show notes directly from your lock screen when you received a new episode notification.

Not familiar with PremoFM?  Check out the video below, then head to Google Play.

.

 

Tom Brady, ESPN, Media, and Barack Obama

600x600bb

Bill Simmons and guest, Chuck Klosterman, cover a ton of ground in the latest Bill Simmons Podcast. Particularly insightful conversation as they discuss how cord cutting affects ESPN’s bottom line, Bills Simmons recent interview of President Obama, and Chuck’s interview with Tom Brady. For example, ESPN loses out on $70/year in revenue for every cable subscriber that cuts the cord (cancels their cable subscription)!? Cord cutting is getting worse (I cut the cord 2 years ago) so I’d imagine they’re losing a ton of money.

As an side, I really just got into The Bill Simmons Podcast….it’s a good one.  Check it out.

You can find podcasts like The Bill Simmons Podcast on PremoFM, in the Google Play Store now.

Discover new passions with PremoFM

Screenshot from 2015-11-10 08:05:44

 Google Play | Website | Twitter


 

I have a wide variety of interests and passions that matter to me, gadgets & technology, programming and UI/UX design, Android, indie rap & hip hop, dope Volkswagens, people of color in technology, New York Jets football, NC State Wolfpack athletics, travel and so many more.  I don’t have a crazy amount of time to sit and read things around my interests, but I have tons of time to listen.  Podcasts fill the majority of my free listening time.

As you’d imagine, I listen to a ton of podcasts. A few of my favorites, His & Hers with Jemele Hill & Michael Smith, The Vergecast, Tomorrow, The Accidental Tech Podcast, and Greenbench Podcast.  I built a podcast app for Android because I wanted to find and listen to more podcasts around my interests and passions and, perhaps, discover new interests and passions.  Now, you can too.  PremoFM 1.0 launches in the Google Play Store today, for free.  I’ve been building it in my spare time for almost a year and using it for about 10 months.  I’ve had beta testers using it for 6 months and now I want everyone to use it.  I have a vision for a podcast app that can help you discover new interests and passions. PremoFM 1.0 is the first step towards that vision.

I expect to move very fast, adding highly sought after features like public podcast collections, Chromecast support, variable speed playback and audio enhancements, better podcast discover-ability, and more

However for today, happy listening.

So, I could probably work on this forever.

screenshots

I’ve been building a podcast app for Android for the last year in my spare time. (Side note: I’ve been building an app for Android for the last 18 months. Fun fact, Premo started off as a contextual messaging app). In the last six months I’ve been working with a small team of beta testers to assist me in creating a great experience for Android podcast fans. It’s time to widen the audience.

Taking a few steps back, I love listening to podcasts. I’m a HUGE podcast fan. That might be an understatement. When I’m not listening to my wife, daughter, friends, or coworkers, I’m listening to podcasts. I started listening to podcasts in the Google Reader days (who remembers Google Listen?). Since then I have tried and purchased many podcast apps on Android including BeyondPod, Podkicker Pro, PlayerFM, and Pocket Casts. They’re all great apps.

But I decided to build a podcast app because I think there’s still room to do something different.

  • I should be able to sample and listen to new podcasts, without needing to subscribe to them
  • I should be able to share my collections of podcasts and episodes with other listeners, easily
  • I should be able to see episode show notes without digging too deeply
  • I should be able to easily organize and navigate my podcasts
  • I should be able to use a beautiful app

I decided to build a podcast app I would love to use. Now I’m making a bet that others will too. Today I’m opening up the beta to anyone running Android 5.0 “Lollipop” or higher. To sign up, visit Premo.FM and click “Join the Beta”.

The beta is free, which given all of the work I’ve put into this app, is crazy. The app may go paid (via an in-app purchase) or become listener supported (donations like public radio). In the meantime, just try it out and send me any feedback on Twitter, @PremoFM. I’m looking forward to it.

Happy listening 🙂