HTTPS SSH

Brid.tv Android Web-SDK

This SDK aims at easily embedding Brid.tv videos on your Android application using WebView. It supports Android 2.3 and superior. Although it is Android Studio and Gradle based, it can easily be used in Eclipse. The SDK is bundled with a sample application

Features

  • Dead simple to use. No need to specify a layout container for the VideoView
  • Supports Android 2.3 and superior

How to use

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 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 the 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 custom player by calling setPlayListId(<playlist_id>)

Custom Player

You can use custom player by calling setVideoId(<video_id>, <player_id>) You can use custom player by calling setPlayListId(<playlist_id>, <player_id>)

Auto play

You can make the video to start as soon as the player is loaded 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();
    }
}