WebView integration

Add the SDK to your project

You can either import the SDK using your IDE or integrate BridWebVideoView.java in your project.

Edit your AndroidManifest.xml file

Add the below to the application tag:

android:hardwareAccelerated="true"
<uses-permission android:name="android.permission.INTERNET" />
Use in your Activity or Fragment

First, add the BridWebVideoView in your layout in place of the regular WebView.

   <tv.brid.websdk.BridWebVideoView
        android:layout_width="300dip"
        android:layout_height="200dip"
        android:id="@+id/bridWebVideoView"
    />

Then in your Activity code just launch your content. You have two options.
If your web page contains more than just a video, load the url content like this:

    private BridWebVideoView mVideoView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.screen_sample);

        mVideoView = ((BridWebVideoView) findViewById(R.id.bridWebVideoView));
        mVideoView.loadUrl("https://www.brid.tv/mobile-html5-video-advertising/");

    }

If you have the id of a video on Brid.tv, then you can set it directly:

    private BridWebVideoView mVideoView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.screen_sample);

        mVideoView = ((BridWebVideoView) findViewById(R.id.bridWebVideoView));
        mVideoView.setVideoId(5143);


    }
Handling of the back button

Your activity must take care of the back button so as to leave fullscreen and not the current Activity:

     @Override
        public void onBackPressed() {
            mVideoView.handleBackPress(this);
        }
Handle screen rotation

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

android:configChanges="orientation|screenSize"

to any activity using BridWebVideoView, in your AndroidManifest.xml.

Playlist

You can use a custom playlist by calling setPlayListId(<playlist_id>)

Custom Player

You can use custom player with a video by calling setVideoId(<video_id>, <player_id>).
You can use custom player with a playlist by calling setPlayListId(<playlist_id>, <player_id>).

Auto play

You can make a video autostart by calling setAutoPlay(true) before setting the id of your video.

Player Methods
callPlayerMethod('play')  
callPlayerMethod('togglePlay')  
callPlayerMethod('pause')  
callPlayerMethod('next')  
callPlayerMethod('previous')  
callPlayerMethod('playByIndex')  
callPlayerMethod('src', '<src>')  
callPlayerMethod('setFullscreen')  
callPlayerMethod('setCurrentTime', '<seek_position>')  
Lifecycle

On Android 3.0+, you have to call onPause and onResume when these events occur in your lifecycle:

@Override
    protected void onPause() {
        super.onPause();

        if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB){
            mVideoView.onPause();
        }
    }

@Override
protected void onResume() {
    super.onResume();

    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB){
        mVideoView.onResume();
    }
}