Setup BridPlayer

The BridPlayer is a core component of our SDK and provides a simple and intuitive interface for managing media playback in your app. With the BridPlayer, you can easily load new media, control playback, and register event listeners to track and handle various player events.

Prepare Frame Layout

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

<FrameLayout
        android:id="@+id/bridVideoHolder"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

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

val videoHolder: FrameLayout = findViewById(R.id.bridVideoHolder)
val bridPlayer: BridPlayer = BridPlayerBuilder(this, videoHolder).build()
FrameLayout videoHolder = findViewById(R.id.videoHolder);
BridPlayer  bridPlayer = new BridPlayerBuilder(this, videoHolder).build();

As shown in the example above, to create a BridPlayer object, you need to create a new BridPlayerBuilder object and pass it the context of your activity and the FrameLayout where the player will be displayed.

You can configure various parameters of the player using the methods provided by the BridPlayerBuilder class. A detailed description of all available parameters is provided in the following section.

Load Video

Load video or playlist:

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

The playerID, videoID, and playlistID are generated from our platform, and in order to use them, you must have an active subscription to one of our plans.

Destroy Player

It demonstrates the proper way to release the resources of the BridPlayer when the hosting Activity or Fragment is being destroyed. Calling bridPlayer.release() in the onDestroy() method ensures that all resources allocated by the BridPlayer, such as memory and system resources, are properly cleaned up. This step is crucial to prevent memory leaks and ensure that the application runs smoothly, especially when the user navigates away from the player or the application is closed.

@Override
public void onDestroy() {
    super.onDestroy();
    // Ensure the player is released to free up resources
    bridPlayer.release();
}