Welcome to Viblast Documentation

Everything you need to know about Viblast Solutions. For more information contact us.

Viblast Documentation

Getting Started with Viblast for Android

Download the provided viblast-<domain>-<version>.android.zip file and extract it into the directory of your project

unzip viblast-<domain>-<version>.android.zip -d <path-to-your-android-project>

After that you should have a viblast.jar and exoplayer.jar file in your project libs/ directory and two file called libviblast.so and libnative-viblast.jni.so in the libs/armeabi/ and libs/x86/ directory.

Viblast requires Internet access in order to work, so make sure you have requested the appropriate permissions in your AndroidManifest.xml file

<manifest xmlns:android="http://schemas.android.com/apk/res/android" >
    <uses-permission android:name="android.permission.INTERNET" />

Create a ViblastView inside your layout

        android:layout_gravity="center" />

Naturally, you can specify the parameters most suitable for your application's interface. The code above is just an example.

The only thing you need is a ViblastPlayer instance. A good spot to create it is in the Activity's onCreate method.

public class MainActivity extends Activity {
    ... // as usual
    private ViblastPlayer viblastPlayer;
    private ViblastView viblastView;

    protected void onCreate(Bundle savedInstanceState) {
        ... // as usual

        viblastView = (ViblastView)findViewById(R.id.viblast_view);

        final ViblastConfig vbConfig = new ViblastConfig();
        vbConfig.advancedConfig.put("enable-pdn", "true");
        vbConfig.advancedConfig.put("enable-realtime-loggger", "true");
        vbConfig.advancedConfig.put("realtime-logger-server", "wss://cs.viblast.com/rt");

        viblastPlayer = new ViblastPlayer(viblastView, vbConfig);

Start Viblast on Activity start

protected void onStart() {

Don't forget to stop Viblast when the Activity stops

protected void onStop() {

That's about it. Your video playback through Viblast should begin after you start your Activity.

Checking playback state

There are five playback states: - IDLE - The player is neither prepared or being prepared. - PREPARING - The player is being prepared. - BUFFERING - The player is prepared but not able to immediately play from the current position. This state typically occurs when more data needs to be buffered for playback to start. - PLAYING - The player is playing. - ENDED - The player has finished playing the media.

There are two options for checking playback state: * check current playback state * Simply call viblastPlayer.getPlaybackState(): java viblastPlayer = new ViblastPlayer(viblastView, vbConfig); playbackState = viblastPlayer.getPlaybackState();

  • listen for playback state changes
    • Add listener to viblastPlayer: java viblastPlayer = new ViblastPlayer(viblastView, vbConfig); viblastPlayer.addListener(new Listener() { @Override public void onPlaybackStateChanged(ViblastPlayerState state) { // state contains new playback state } // ... });