Better Video Player


1.2.alpha1 (May 1, 2018)
Sep 16, 2016
May 2, 2018
Halil Ozercan (halilozercan)
Aidan Follestad (afollestad)
Halil Ozercan (halilozercan)
Márton Braun (zsmb13)
Source code
APK file


Better Video Player

Better Video Player is a rethought version(fork) of Easy Video Player.

  • Based on the stock MediaPlayer API It will work on all devices and all CPUs, and it works with both local and remote sources.
  • Simple Much less code is required than alternative options to get up and running.
  • Very configurable There are lots of options available to make the player behave exactly how you want it to behave.
  • Adaptive The player use the colors of your (AppCompat) Activity theme automatically.
  • Swipe Gestures Supports the common on-screen scroll behavior which is used by MXPlayer, VLC and other Android media players.
  • Double tap to seek Very youtube like double tap to seek with custom time.

Add this in your module's build.gradle file:

dependencies {
    // ... other dependencies
    compile 'com.github.halilozercan:BetterVideoPlayer:1.2.alpha1'

Getting Started

Configuring a Player Activity

You will need an Activity in your app that will hold the BetterVideoPlayer view and playback content. There's only a bit of configuration required. However, BetterVideoPlayer offers great 'customizability'.

First, the Activity needs to use a theme from Google AppCompat. Here's an example from the sample project:

<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">

    <item name="colorPrimary">@color/primary</item>
    <item name="colorPrimaryDark">@color/primary_dark</item>
    <item name="colorAccent">@color/accent</item>


Second, the Activity should disable recreation on orientation changes. This allows playback to continue when the device orientation changes. The player will adapt the aspect ratio accordingly. You just need to set android:configChanges values to your Activity in AndroidManifest.xml:

    android:theme="@style/AppTheme" />   <!-- Don't need to set the theme here if it's set on your <application /> tag already -->

The layout for your player Activity can be very simple. You only need a BetterVideoPlayer view, all the controls and everything else are created by the player view itself.

    android:layout_height="match_parent" />

Before moving onto code setup, here is a list of changes that are made to EasyVideoPlayer.

Easy Video Player

Most of the features from Easy Video Player is still available in its core. Although many configuration options were added, simplicity and ready-to-go behavior is not changed. This document will go through added and removed features.

Removed Features


In my opinion, 2 actions that are placed under MediaPlayer controls were uneasy to use. Library should not put developer to choose between drawable and string resources for action buttons. Also, 2 means multiple. If number of actions are 2, then it can be 10 or more.

Instead, BetterVideoPlayer takes advantage of Toolbar API. Basically, there is a toolbar at the top of BetterVideoPlayer. Custom View API lets you to set title and populate a menu of actions on this toolbar.

Removed anything related to actions. LeftAction, RightAction, BottomLabel, SubmitButton, RetryButton.


While using Easy Video Player, implementing a fullscreen video activity had been cumbersome for me. Maybe it was my fault but I could not achieve the behavior I wanted with given fullscreen feature. In the end I ended up changing behavior of the view completely. In my opinion, every fullscreen video activity can have different kind of tweak for a given user input. That is why setAutoFullscreen() has been removed from the API.

To see an example of how you can use BetterVideoPlayer in fullscreen, refer to sample app

Added Features


BetterVideoPlayer supports captions through subtitles in 2 formats; SRT and WEBVTT.

Captions can be obtained both online and from resource directory.

Support for local storage will be added in the near future.

// Online SUBRIP subtitle
bvp.setCaptions("", SubtitleView.SubtitleMime.SUBRIP);

// res/raw SUBRIP subtitle
bvp.setCaptions(R.raw.sub, SubtitleView.SubtitleMime.SUBRIP);

BetterVideoPlayer also lets you define the text size(in sp) and color of captions inside XML view.

CaptionsView will be seperated from BetterVideoPlayer in next versions. This will allow developers to customize the captions even further.



BetterVideoPlayer deploys a common toolbar at the top of player. Toolbar is useful in a video player in two different ways.

  • First, it offers a highly customizable title text place.
  • Secondly, you can inflate a menu on the toolbar and define as many actions as you need.

To access toolbar, just use getToolbar() method. You can also show and hide the toolbar by using showToolbar() and hideToolbar()

Swipe Gestures

Swipe Gestures on a video player are proved to be very useful by MX, VLC and others. Swiping left and right to seek to any point in video or swipe up and down to control volume and brightness. BetterVideoPlayer comes with built-in support for these gestures. This feature lets your users to be familiar with your video player

You can enable or disable gestures by enableSwipeGestures() and disableSwipeGestures() methods.

Important point: You need to use enableSwipeGestures(Window) method to also enable brightness control. Brightness setting needs a reference window.

Code Setup

Since your Activity is using an AppCompat theme, make sure it extends AppCompatActivity.

Initializing the player is very simple. You just set a callback listener to receive notifications of important events, and a source.

public class MyPlayerActivity extends AppCompatActivity implements BetterVideoCallback {

    private static final String TEST_URL = "";

    private BetterVideoPlayer player;

    protected void onCreate(Bundle savedInstanceState) {

        // Grabs a reference to the player view
        player = (BetterVideoPlayer) findViewById(;

        // Sets the callback to this Activity, since it inherits EasyVideoCallback

        // Sets the source to the HTTP URL held in the TEST_URL variable.
        // To play files, you can use Uri.fromFile(new File("..."))

        // From here, the player view will show a progress indicator until the player is prepared.
        // Once it's prepared, the progress indicator goes away and the controls become enabled for the user to begin playback.

    public void onPause() {
        // Make sure the player stops playing if the user presses the home button.

    // Methods for the implemented EasyVideoCallback

    public void onStarted(BetterVideoPlayer player) {
        //Log.i(TAG, "Started");

    public void onPaused(BetterVideoPlayer player) {
        //Log.i(TAG, "Paused");

    public void onPreparing(BetterVideoPlayer player) {
        //Log.i(TAG, "Preparing");

    public void onPrepared(BetterVideoPlayer player) {
        //Log.i(TAG, "Prepared");

    public void onBuffering(int percent) {
        //Log.i(TAG, "Buffering " + percent);

    public void onError(BetterVideoPlayer player, Exception e) {
        //Log.i(TAG, "Error " +e.getMessage());

    public void onCompletion(BetterVideoPlayer player) {
        //Log.i(TAG, "Completed");

    public void onToggleControls(BetterVideoPlayer player, boolean isShowing) {
        //Log.i(TAG, "Controls toggled " + isShowing);

You can see almost identical code in action in the sample project.