Build the best video experiences

APIs that enable you to delight your viewers

Manage videos using API, enable automatic video upload and get OTP for playback

Inject custom HTML in video player, change player design and add interactive features using Player API

Integrate VdoCipher SDK to your app with the help of our sample Android app and Maven Project

OTP-based Playback

Why You Need OTP for Secure Streaming

Non-secure video platforms enable video embed through iFrames. These iFrames however can be used by anybody to download or share the video.

VdoCipher uses a unique embed code per session to play videos. This embed code uses a short-lived access token, called an OTP. Our use of an OTP ensures that videos are authenticated in every session, so that only logged in paying users get to watch your premium content.

How to generate OTP

  • You can find the API secret key for your account by logging into the Dashboard -> Config tab.
  • To generate OTP and playbackInfo, your site backend has to make HTTP POST request to API server using the API secret key. The API URL has to include the video ID.
  • The API call returns OTP and Playback Info, which your site backend has to then add to the video embed code.
  • You can find more details and sample codes for generating OTP from the Server API Docs.

Sample Code for HTTP POST request to API server with Secret key

$ curl -X POST https://dev.vdocipher.com/api/videos/{VIDEOID}/otp -H
      'authorization: Apisecret _________'
      

The API call would return a JSON object with OTP and playback info:

{
    "otp": "1234567890z26y25x24",
    "playbackInfo": "a1b2c3d4e5f6h7"
}
      

Video Player Embed Code

Your website backend needs to send the OTP and playbackInfo to the site frontend, to authorize video playback. More details on the player embed code can be found in the VdoPlayer Reference.


    <div id="embedBox" style="width:1280px;max-width:100%;height:auto;"></div>
            <script>
              (function(v,i,d,e,o){v[o]=v[o]||{}; v[o].add = v[o].add || function V(a){ (v[o].d=v[o].d||[]).push(a);};
            if(!v[o].l) { v[o].l=1*new Date(); a=i.createElement(d), m=i.getElementsByTagName(d)[0];
            a.async=1; a.src=e; m.parentNode.insertBefore(a,m);}
            })(window,document,"script","https://cdn-gce.vdocipher.com/playerAssets/1.6.6/vdo.js","vdo");
            vdo.add({
              otp: "REPLACE WITH OTP",
              playbackInfo: "REPLACE WITH playbackInfo",
              theme: "9ae8bbe8dd964ddc9bdb932cca1cb59a",
              container: document.querySelector( "#embedBox" ),
            });
            </script>
          

You may wish to change the id of the global div, from embedBox to something more unique. For instance you may append a random number to embedBox, so that each video player displayed on your page has a unique id.

Integrating VdoCipher Embed Code

There are broadly two kinds of web applications - MVC apps and SPAs. VdoCipher integration for the respective use cases differ slightly.

MVC Applications

In Web Apps using Model-View-Controller Architecture the backend directly renders the web page. Prominent platforms using MVC architecture are PHP frameworks (Laravel, Yii), Python (Django), Ruby on Rails, and Jade Template Engine using Express

In MVC apps the OTP can be generated when the page itself is loading. You can pass the OTP and PlaybackInfo as parameters from Controller to View. With these parameters added to the embed code your video would be ready to play.

Single-Page Applications

Single Page Apps (SPA) load scripts and other assets only once per session. Data for each new page is served using JSON or XML. React and Angular are the most prominent platforms for building SPAs

In an SPA it is recommended to create an API endpoint which can authenticate the logged-in user and check their access to the requested videos. This endpoint will return the OTP and PlaybackInfo. The front end would handle the response and load the video.

Detailed reference for adding VdoCipher videos to your SPA can be found in the VdoCipher server API reference

Ready-to-Use Plugins

For popular Content Management Systems you will only need to install VdoCipher plugin. Our plugin handles the OTP and PlaybackInfo generation by itself, so that embedding videos to your website is easy and straightforward.

VdoCipher Support is always there for you

As you can see, adding security features to videos creates additional steps to your workflow beyond simply adding a single embed code.

We fully understand that there might be things that you would need our help for. Our support executives are available at all times to help you secure your encrypted videos to your site.

We are fully committed to providing you Hollywood-level DRM for your invaluable intellectual property, and to support you in creating your video-based business.

Check out our Secure Streaming features

Sign up for a free 30-day trial to get started