A simplified Player
wrapper for MediaPlayer and ExoPlayer
Some of the benefits are -
- Unified playback interface and event listeners.
MediaPlayer
buffering.ExoPlayer
local, streaming and provisioning widevine modular DRM.- Aspect ratio maintaining.
- Player selection based on
ContentType
and DRM.
To start using this library, add these lines to the build.gradle
of your project:
repositories {
jcenter()
}
dependencies {
compile 'com.novoda:no-player:<latest-version>'
}
Creating a Player
Player player = new PlayerBuilder()
.withPriority(PlayerType.EXO_PLAYER)
.withWidevineModularStreamingDrm(drmHandler)
.build(this);
Creating the PlayerView
R.layout.player_activity
<com.novoda.noplayer.NoPlayerView
android:id="@+id/player_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
Attaching to a PlayerView
PlayerView playerView = findViewById(R.id.player_view);
player.attach(playerView);
Playing Content
player.addPreparedListener(new Player.PreparedListener() {
@Override
public void onPrepared(PlayerState playerState) {
player.play();
}
});
Uri uri = Uri.parse("http://yt-dash-mse-test.commondatastorage.googleapis.com/media/car-20120827-manifest.mpd");
player.loadVideo(uri, ContentType.DASH);
Here are a list of useful links:
- We always welcome people to contribute new features or bug fixes, here is how.
- If you have a problem check the Issues Page first to see if we are working on it.
- Looking for community help, browse the already asked Stack Overflow Questions or use the tag:
support-no-player
when posting a new question.