Android SDK reference

Players android SDK reference

This SDK aims at easily embedding Brid videos on your Android application. It's based on ExoPlayer and supports Android 4.1 (API level 16) and later.

Add the SDK to your project

The easiest way to get started using Brid Player is to add it as a gradle dependency. First, you need to add maven repository to the build.gradle file in the root of your project:

repositories {

Next, add a gradle compile dependency to the build.gradle file of your app module:

implementation 'tv.brid.sdk:bridsdk:1.0.21'

Edit your AndroidManifest.xml file

Add the following directives to the application tag:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

Use in your Activity or Fragment

First, add the FrameLayout holder in your layout where you want player to show.

        android:layout_height="wrap_content" />

Then in your Activity code just instantiate new Brid Player in that layout:

FrameLayout videoHolder = findViewById(;
BridPlayer  bridPlayer = BridPlayerBuilder(this, videoHolder).build();

And load video or playlist:

bridPlayer.loadVideo(playerId, videoId);
bridPlayer.loadPlaylist(playerId, playlistId);

Handling activity/fragment lifecycles

Your activity/fragment should take care of resources on pausing/resuming/destroying:

    public void onResume() {

    public void onPause() {

    public void onDestroy() {

Handle screen rotation

For the screen rotation to be handled correctly, you need to add:


to any activity using BridPlayer (in your AndroidManifest.xml)

View debug toast messages

To view debug messages, call the following method after creating BridPlayer object:


You can set debug level using the following constants: BridPlayer.DEBUG_LOG, BridPlayer.DEBUG_ERRORS, BridPlayer.DEBUG_ADS, BridPlayer.DEBUG_ANALYTICS, BridPlayer.DEBUG_ALL. For example:

    bridPlayer.setDebug(BridPlayer.DEBUG_ADS | BridPlayer.DEBUG_ANALYTICS);

Setting listeners

To monitor player events you can set listener:

    bridPlayer.setListener(new BridPlayer.BridPlayerListener() {
        public void onEvent(String status) {
            Log.d("PLAYER EVENT", status);

Example methods

Force autoplay:


Get index of video currently playing:


Get position in the video:


Other methods:;

Serving VPAID video ads

Since Google IMA only supports VAST ad tags, in order to serve other ad tag formats(VPAID) , you need to implement the following code:

bridPlayer = new BridPlayerBuilder(this, videoHolder).build;


This class can be used if you want to show fake player (poster image with play button and video title). You might find it useful in situations when you plan to launch video in a new activity, and don't need full featured player there. Consider using this approach when you need to show several players in the same activity or fragment.

BridPoster bridPoster = new BridPoster(this, videoHolder);
bridPoster.loadVideo(335, 186483);
bridPoster.setListener(new BridPoster.BridPosterListener() {
    if (event.equals(BridPoster.EVENT_PLAY_CLICKED)) {
        int playerId = data.getInt("playerId");
        int videoId = data.getInt("videoId");
        int playlistId = data.getInt("playlistId");

Specify callback on specific event

You can specify callback function which will be executed when specific event occured in the player.
Here is the complete list of supported callbacks:

Specify callback when loadVideo function is executed

public void loadVideo(int playerId, int videoId, FetchData callback)

Specify callback when loadPlaylist function is executed

public void loadPlaylist(int playerId, int playlistId, FetchData callback)

Specify callback when loadPlaylistForChannel function is executed

public void loadPlaylistForChannel(int playerId, int channelId, int page, int item, FetchData callback)

Specify callback when loadLatestPlaylists function is executed

public void loadLatestPlaylists(int playerId, int page, int item, FetchData callback)

Specify callback when loadPlaylistForTag function is executed

public void loadPlaylistForTag(int playerId, String tagType, int page, int item, FetchData callback)