VdoCipher Android SDK

Secure Video Streaming using Android App

Latest version: 1.0.0-beta6

This SDK enables you to securely stream DRM-protected videos through your Android app.

Getting Started

Add VdoCipher maven repo to app module's build.gradle

  repositories {
    // other repo, e.g. jcenter()
      url "https://github.com/VdoCipher/maven-repo/raw/master/repo"

Add dependency

  compile 'com.vdocipher.aegis:vdocipher-android:1.0.0-alpha11'

Note: If your project has a local dependency on a previous version of the SDK (AAR module dependency), you'll need to remove them from the project.

  // remove this dependency if it exists from use of a previous version of SDK
    compile project(':vdocipher')

Integrating video playback

To integrate a player, just drop a VdoPlayerFragment into your activity layout with an id.


and receive its instance in your activity using findFragmentbyId()

  playerFragment = (VdoPlayerFragment)getFragmentManager().findFragmentById(R.id.online_vdo_player_fragment);

Get a VdoPlayer instance by calling PlayerHost.initialize() method on the playerFragment and receive the player in the onInitializationSuccess callback.

You can add callbacks for listening to playback events using VdoPlayer.addPlaybackEventListener() on the VdoPlayer object that is received in the onInitializationSuccess callback.

    public void onInitializationSuccess(VdoPlayer.PlayerHost playerHost, VdoPlayer player, boolean wasRestored) {
        Log.i(TAG, "onInitializationSuccess");
        this.player = player;
        // add a listener for playback events
        // ...

Once you have a player, you can start loading media onto it for playback. You'll need a VdoInitParams object to specify which media to load along with your preferences.

A VdoInitParams object needs playbackInfo and either otp or signature generated from your server.

  // load a media to the player
    VdoPlayer.VdoInitParams vdoParams = VdoPlayer.VdoInitParams.createParamsWithOtp(otp, playbackInfo);

This should be followed by onLoading and onLoaded callbacks signalling that media playback can start now.

    public void onLoading(VdoPlayer.VdoInitParams vdoInitParams) {
        Log.i(TAG, "onLoading");

    public void onLoaded(VdoPlayer.VdoInitParams vdoInitParams) {
        Log.i(TAG, "onLoaded");
        // playback can be controlled now

Handling orientation change

To make orientation change seamless, please override config changes for your activity by adding the following to your AndroidManifest.xml. This means that your activity won't go through the regular life-cycle events on device orientation change. If you require to change the layout, please use onConfigurationChanged callback in your activity to change the size or hide/unhide view elements.

Replace the name of activity with correct name.

  <activity android:name=".OnlinePlayerActivity"

Using ProGuard

If you use ProGuard in your app, you might need to add the following rule to your ProGuard file.

  -keep class com.vdocipher.aegis.* { ;  }

Offline Download using SDK

The VdoCipher Android SDK offers capability to download videos to the device's local storage. Videos would then be available for offline playback. This feature is available for Android devices running Lollipop and above (API level 20+).

Please note that the offline download feature has a pricing of $0.007 per download, in addition to the standard pricing plans.

Steps for Offline Android download for videos »



  • Added API to specify start and end time for playback in VdoInitParams
  • Additional error information, when applicable, is available in DownloadStatus#reasonDescription, which can be parsed as a json to obtain details.
  • Bug fixes


  • Support for closed captions.
  • Support for setting aspect ratio and video stretch mode in VdoPlayerFragment.
  • Fixed offline media assets not being deleted on some devices when remove api is used.
  • Fixed occasional crash on background thread when starting a new download.
  • Bug fixes.


  • Added support for downloading media to local storage and playback of offline media
  • Simplified VdoInitParams interface
  • Bug fixes


  • Introduced multiple error codes and extended some in `ErrorCodes` class
  • Added Builder class to `VdoInitParams` as optionsal way to create init params
  • Fixed application crash when initiating secure playback
  • Other minor bug fixes


  • Fixed onMediaEnded callbacks not received in some cases.
  • Fixed loading new VdoInitParams on VdoPlayer which already has a media running: discard current media immediately and load new params.
  • Improved support for testing playback on emulators.
  • Bug fixes.


  • Changed player initialization workflow. Now you can initialize a PlayerHost to obtain a VdoPlayer instance without specifying any VdoInitParams. Once obtained, a VdoPlayer instance can be used to load media for playback.
  • Changed VdoPlayer api. Many api and callback methods have been added/removed/renamed in accordance with increased player capabilities. The javadoc lists the new api.
  • A playbackInfo string along with otp or signature is required for loading media to the player.
  • Added playback speed control related api.
  • Security enhancements and bug fixes.