Video playback

Video playback code examples

Managing video quality

$bp().setVideoSource(rendition)

To set different video source quality use the setVideoSource API call. Read about more details here.

Example:

$bp().setVideoSource("hd");

$bp().on('qualityChange', listener)

More about how to listen on quality change event read here.

$bp().on('qualityChange', function(){
//custom code to execute on qualityChange event
});

Load the player with a specific video rendition quality

You can force a specific video rendition quality that the player will load by adding the video_source parameter to your embed code.

Example:

$bp("myDiv", {
    "id":"PLAYER_ID",
    "width":"640",
    "height":"360",
    "video":"VIDEO_ID",
    "video_source":"hd"
});

Set a maximum bitrate for HLS video streams

You can set a maximum bitrate you want your Brid player to use when your video sources are HLS video files. See example below on how to do this.

Example:

$bp("myDiv", {
    "id":"PLAYER_ID",
    "width":"640",
    "height":"360",
    "video":"VIDEO_ID",
    "hls_max_bitrate":"500000"
});

Working with playback

Seek anywhere on the players timeline

The code snippet below shows how to use the API to seek anywhere on the players timeline. The code below will seek to the 90 second mark of a video.

Example:

$bp().currentTime(90);

Force player to load audio files without a valid audio extension

You can force a Brid player to reproduce audio files without valid audio extensions by adding the following parameter to your embed code force_play_unknown_extensions.

Example:

$bp("myDiv", {
    "id":"PLAYER_ID",
    "width":"640",
    "height":"360",
    "video":"VIDEO_ID", 
    "force_play_unknown_extensions" : true
});

Video click-through

Add a video click-through URL programmatically

Use the following code snippet to add or remove a video click-through URL via the player's JS API.

Example:

$bp().on("ready", function(){
// Set a custom click-through URL
this.currentSource.clickthroughUrl = "http://www.google.com";

// Remove a click-through URL
this.currentSource.clickthroughUrl = "";

});

Custom video click-through

Below example shows how to add custom clickthrough URL to the video.

Example:

function onReady() {
    this.touch.add('click', function () {
            window.open('http://google.com', '_blank');
        });
}
$bp("myDiv", config, onReady);

Volume

Set custom volume

Using the below example you can programmatically set volume of the player.

Example:

$bp("myDiv", config, function(){
    this.volume(0.2);
});

Did this page help you?