ITEC MediaPlayer reaching v3.0, getting production-ready and a new name: MediaPlayer-Extended

Since the previous post from about a year ago, the ITEC MediaPlayer for Android has evolved to its second major version, receiving a lot of bugfixes, a rewritten playback core with huge performance improvements, and the ability to playback audio-only sources. Its new name now bumps it to version 3.0, and it is reaching a point where I feel confident that it can be used in production. In fact, people are already starting to use it.

Improvements from 1.4.0

Between 1.4.0 and the current 2.2.3/3.0.0, lots of work has gone into improving the internal playback core. It has gone from hacky spaghetti code, that somehow worked, to a nicer, clearer and more flexible architecture, that results in major playback performance improvements and the ability to playback audio-only sources as well as video with/without audio. The new playback core needs way less CPU time (usage has dropped from ~40% to ~5% for 30fps 1080p video on my Nexus 4) and allows up to 4x playback speed (formerly 2x). The API has been further adjusted to match Android’s MediaPlayer API, and some more missing methods have been added (setVolume, setLooping, prepare/prepareAsync). Of course, many known bugs have also been fixed.

Audio playback

In complex cases, where multiple streams need to be played back at the same time (e.g. multitrack playback of video and multiple audio tracks), developers had to use Android’s MediaPlayer for audio playback. This is not a technical problem, as the Android MediaPlayer does the job just fine (seeking audio is precise enough for most use-cases), but it could lead to messy code when similarly named classes had to be imported from two different namespaces. Audio-only support thus leads to nicer code for the aesthetics-prone developer, besides making this library more universal to use.

New name

The “ITEC” in the old name was a remnant from a former employer, and has originally been chosen as gratitude for being allowed to develop the initial version during working hours. Since then, lots of additional development time has gone into this project and there is no relation to my former employer anymore, so it was time to leave the old name behind. The library will from now on be simply known as MediaPlayer-Extended. Due to the name change, the library had to be given a new major version 3.0.0, which is functionally equivalent to version 2.2.3, except that the package name has changed from at.aau.itec.android.mediaplayer to net.protyposis.android.mediaplayer.

Documentation

Like often in such projects, one aspect that isn’t really getting too much attention is the documentation. Luckily, MediaPlayer-Extended’s aim is to be API-compatible with Android’s MediaPlayer and VideoView classes, and Android’s documentation can therefore be used as a reference. MPX does not implement all methods that the Android API provides, but the ones that are implemented should work similarly (if you notice a difference, please open an issue on GitHub). Additional methods are either described in the project description (MediaSource API), or their usage can be looked up in the code of the demo application (setSeekMode, setPlaybackSpeed, setZoom/setPan/addEffect/selectEffect/captureFrame in GLES VideoView).

Download

If you need an easy to use media player on Android with features like frame-exact seeking, GLES shader support, picture panning and zooming, playback speed adjustment, DASH support, give this library a try. If you are already using Android’s MediaPlayer API, you don’t even have to rewrite your code. Check out the sources on GitHub, fetch the library from Bintray with Maven or Gradle, or download the demo showcase app from Google Play. There might still be some minor bugs lingering, but nothing that can’t be solved by opening an issue on GitHub.