From: https://developer.android.com/samples/BasicMediaDecoder/index.html converted to work with Android Studio 0.8.2