Methods
Available methods
List of available methods in the BridPlayer interface:
//Force autoplay
bridPlayer.setAutoPlay(true);
//Get index of video currently playing
bridPlayer.getCurrentVideo();
//Get position in the video
bridPlayer.getCurrentPosition();
// Start playback of the current media item
bridPlayer.play();
// Toggle between play and pause states
bridPlayer.togglePlay();
// Pause playback of the current media item
bridPlayer.pause();
// Play the previous media item in the playlist
bridPlayer.previous();
// Play the next media item in the playlist
bridPlayer.next();
// Set the player to fullscreen or exit fullscreen
bridPlayer.setFullscreen(<true|false>);
// Seek to a specified position in the current media item
bridPlayer.seekTo(<seek_position_milliseconds>);
// Show or hide the loading indicator on the player UI
bridPlayer.setLoadingIndicator(<true|false>);
BridPoster
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(playerID, videoID);
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");
}
});
val bridPoster = BridPoster(this, videoHolder)
bridPoster.loadVideo(playerID, videoID)
bridPoster.setListener(object : BridPoster.BridPosterListener {
override fun onEvent(event: String, data: Bundle) {
if (event == BridPoster.EVENT_PLAY_CLICKED) {
val playerId = data.getInt("playerId")
val videoId = data.getInt("videoId")
val 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)
Updated about 2 months ago