Best android open-source packages and libraries.

AndroidPlayer

MediaPlayer abstraction that can set custom speed. Including a fallback for non supported devices.
Updated 3 years ago

DEPRECATED

This project is no longer maintained. As of Version 2.4, ExoPlayer supports custom playback speed.

And it is not such a awful state machine as the Android MediaPlayer.

Android Speed Player

CI Status

This player is a MediaPlayer abstraction for Android. It mimics but simplifies the Android MediaPlayer through the usage of Kotlin.
As kotlin produces JVM bytecode this can be used from java too.

It also supports setting a custom playback speed for Android API >= 16 by using a custom implementation based on Prestissimo with heavy modifications.

This library is still in beta phase and its API is a subject to changes.

Get started

The player is defined through a simple interface called MediaPlayer which works like the Android MediaPlayer. There is one little difference: Instead of setDataSource(String) and prepare() it simplifies that by skipping that state so you call prepare(Uri) directly.

val player: MediaPlayer = SpeedPlayer(context) // or AndroidPlayer(context) if < API 16 or >= 23
val file = File("/storage/sdcard/test.mp3")
player.prepare(Uri.fromFile(file))
player.start()

For events you can simply set your listeners:

player.onCompletion { Log.i("Player", "Player completed") }
player.onError { Log.i("Player", "There was an error") }
player.onPrepared { Log.i("Player", "Player prepared!") }

Installation

build.gradle:

dependencies {
    compile 'com.github.PaulWoitaschek:AndroidPlayer:$latestVersion'
}

Top gradle:

allprojects {
    repositories {
        ...
        maven { url "https://jitpack.io" }
    }
}

License

Copyright 2015 Paul Woitaschek

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.