APIs and Sample Codes Archives - VdoCipher Blog https://www.vdocipher.com/blog/category/api/ Secure Video Streaming Thu, 18 Jan 2024 09:50:41 +0000 en-US hourly 1 https://wordpress.org/?v=6.4.5 https://www.vdocipher.com/blog/wp-content/uploads/2016/11/cropped-VdoCipher-logo2-32x32.png APIs and Sample Codes Archives - VdoCipher Blog https://www.vdocipher.com/blog/category/api/ 32 32 Redirected: PHP sample video upload from browser to VdoCipher https://www.vdocipher.com/blog/2016/03/php-sample-video-upload-from-browser-to-vdocipher/ https://www.vdocipher.com/blog/2016/03/php-sample-video-upload-from-browser-to-vdocipher/#respond Sun, 02 Oct 2022 08:37:43 +0000 https://www.vdocipher.com/blog/?p=450 [This article is based on API v2 as documented here.] The Upload API workflow and overview can be found here. Please find below a sample code for enabling video upload from your PHP website’s users. Note that this is sample code and you will need to configure it according to the controller-view structure in your application. It […]

The post Redirected: PHP sample video upload from browser to VdoCipher appeared first on VdoCipher Blog.

]]>
here.]

The Upload API workflow and overview can be found here.

Please find below a sample code for enabling video upload from your PHP website’s users. Note that this is sample code and you will need to configure it according to the controller-view structure in your application. It is not a recommended to put Controller logic and HTML output in a single file.

https://gist.github.com/vibhavsinha/71d394132a98c049f8aa

<?php
function send($action, $params, $posts = false){
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    $getData = http_build_query($params);
	$postData = ['clientSecretKey'=>'CLIENT_SECRET_KEY'];            ////Replace the caps CLIENT_SECRET_KEY with your video id.
    if ($posts) {
		$postData = http_build_query(array_merge($postData, $posts));
	}
    curl_setopt($curl, CURLOPT_POST, true); 
    curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
    $url = "http://api.vdocipher.com/v2/$action/?$getData";
    curl_setopt($curl, CURLOPT_URL,$url);
    $html = curl_exec($curl);
    curl_close($curl);
    return $html;
}

$upload_data = json_decode(send('uploadPolicy', [], ['title'=>'NEW_TITLE']), true);
if (is_null($upload_data)) {
	throw new Exception('Exception: ' . $upload_data);
}
?>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  </head>
  <body>

  <form action="<?= $upload_data['upload_link_secure'] ?>" method="post" enctype="multipart/form-data">
    Key to upload: 
	<input type="hidden"  name="key" value="<?= $upload_data['key'] ?>" /><br />
	<input type="hidden" name="success_action_status" value="201" />
	<input type="hidden" name="success_action_redirect" value="https://www.vdocipher.com" />

	<input type="hidden"   name="X-Amz-Credential" value="<?= $upload_data['x-amz-credential'] ?>" />
	<input type="hidden"   name="X-Amz-Algorithm" value="<?= $upload_data['x-amz-algorithm'] ?>" />
	<input type="hidden"   name="X-Amz-Date" value="<?= $upload_data['x-amz-date'] ?>" />

	<input type="hidden" name="Policy" value='<?= $upload_data['policy'] ?>' />
	<input type="hidden" name="X-Amz-Signature" value="<?= $upload_data['x-amz-signature'] ?>" />
    File: 
    <input type="file"   name="file" /> <br />
    <!-- The elements after this will be ignored -->
    <input type="submit" name="submit" value="Upload to Amazon S3" />
  </form>
</html>

When setting up your front-end, you will like to enable better interface with AJAX upload such that your user’s can have a seamless experience. For this it is recommended to use one of the available libraries(angularjs, jquery or standalone, etc.) . Note that all these can be modified to be used in this set up. You can also see a sample implementation of the angular’s ng-file-upload library in your vdocipher dashboard itself.

The post Redirected: PHP sample video upload from browser to VdoCipher appeared first on VdoCipher Blog.

]]>
https://www.vdocipher.com/blog/2016/03/php-sample-video-upload-from-browser-to-vdocipher/feed/ 0
C# sample API for video upload from browser to VdoCipher https://www.vdocipher.com/blog/2022/09/c-sample-video-upload-from-browser-to-vdocipher/ https://www.vdocipher.com/blog/2022/09/c-sample-video-upload-from-browser-to-vdocipher/#respond Fri, 02 Sep 2022 15:01:09 +0000 https://www.vdocipher.com/blog/?p=438 To automate your video website platform, you need video upload directly through your website. Read this for details about this method. The following code gives an example written in C#. C# Sample Code​ for VdoCipher OTP Generation In this example, the sample videoID is 1234567890, and the API Secret Key is a1b2c3d4e5. The time-to-live for OTP validity is set to […]

The post C# sample API for video upload from browser to VdoCipher appeared first on VdoCipher Blog.

]]>
To automate your video website platform, you need video upload directly through your website. Read this for details about this method. The following code gives an example written in C#.

C# Sample Code​ for VdoCipher OTP Generation

In this example, the sample videoID is 1234567890, and the API Secret Key is a1b2c3d4e5. The time-to-live for OTP validity is set to 300s in the sample code. You can reference the API documentation for more info.

var client = new RestClient("https://dev.vdocipher.com/api/videos/1234567890/otp");
var request = new RestRequest(Method.POST);
request.AddHeader("Accept", "application/json");
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Apisecret a1b2c3d4e5");
request.AddParameter("undefined", "{\n\t\"ttl\":300\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

The controller makes an API request to VdoCipher API to get authorized data about the upload. View file creates the HTML form required for uploading data. Note that the HTML form is only for illustration. You need to hide the extra input fields and perhaps use one of the better javascript libraries (angularjs, jquery or standalone, etc.) for video upload to make user flow better according to rest of your website.

https://gist.github.com/vibhavsinha/cb35c43b874e52c69dd2

After the video is uploaded, it is not ready instantly. Do not load the player immediately. Use the API to query when video is ready and only then render the video player. The API for querying video status is described in the API reference as videos.

FAQs

How to protect your C# video streaming on the backend?

The security integration of video streaming, like multi-DRM, is not directly available for C# use. The easiest solution would be to use a secure video streaming service provider like VdoCipher and integrate with their APIs compatible with the C# backend.

How to secure API in C#?

API gets used as a documented method of interacting with other services, and that is why there is no exact answer to the question, but applying OAuth and using a shared secret along with the request made can work as generic solutions.

Is C# vulnerable to Video Security lapses?

No, it has nothing to do with video security, as videos get secured through cloud encoding and global distribution via a dynamic key exchange mechanism.

 

The post C# sample API for video upload from browser to VdoCipher appeared first on VdoCipher Blog.

]]>
https://www.vdocipher.com/blog/2022/09/c-sample-video-upload-from-browser-to-vdocipher/feed/ 0
PHP implementation of VdoCipher API for Video Security https://www.vdocipher.com/blog/2014/12/php-implementation-vdocipher-api/ https://www.vdocipher.com/blog/2014/12/php-implementation-vdocipher-api/#respond Thu, 01 Sep 2022 01:05:38 +0000 http://www.vdocipher.com/blog/?p=224 Update 5 June 2018 This implementation of VdoCipher Secure Streaming API is updated for latest API version v3, and for latest player version 1.6.4. A previous version of the blog used API v2. While we still support API version v2 we recommend that you use API v3 as part of your video workflow. If you […]

The post PHP implementation of VdoCipher API for Video Security appeared first on VdoCipher Blog.

]]>
Update 5 June 2018 This implementation of VdoCipher Secure Streaming API is updated for latest API version v3, and for latest player version 1.6.4. A previous version of the blog used API v2. While we still support API version v2 we recommend that you use API v3 as part of your video workflow. If you have any queries regarding API v2 please do get in touch with us at support@vdocipher.com. The complete VdoCipher API reference is available here. A sample video-based workflow for your website is suggested here.

Here is a PHP code to use VdoCipher API along with dynamic watermarking. You need to pass the video ID to the vdo_embed function in embed_code.php and the your API secret key to the $api_key variable in vdo_embed.php. The code should work out of the box after editing the details. The sample code is so structured that you only need to add vdo_embed.php once to your file system, and enter the embed code given in embed_code.php at each instance of video player.

https://gist.github.com/milangupta4/e171ab540f949d64ab07244236dacfab

The structure of annotation JSON is described in the link : Add text to videos with watermark. To add user details you can create a $userdetail variable which will collect user-identifiable information such as name and email address from your website database, and append it to the watermark.

PHP Sample code to get OTP

In this example, the sample videoID is 1234567890, and the API Secret Key is a1b2c3d4e5. The time-to-live for OTP validity is set to 300s in the sample code. You can reference the API documentation for more info.

$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://dev.vdocipher.com/api/videos/1234567890/otp",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
"ttl" => 300,
]),
CURLOPT_HTTPHEADER => array(
"Accept: application/json",
"Authorization: Apisecret a1b2c3d4e5",
"Content-Type: application/json"
),
));


$response = curl_exec($curl);
$err = curl_error($curl);


curl_close($curl);


if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}

FAQs

How to protect your videos on the PHP backend?

The security integration of video streaming, like multi-DRM, is not directly available for PHP use. The easiest solution would be to use a secure video streaming service provider like VdoCipher and integrate with their APIs compatible with the PHP backend.

How to secure API in PHP?

API gets used as a documented method of interacting with other services, and that is why there is no exact answer to the question, but applying OAuth and using a shared secret along with the request made can work as generic solutions.

Is PHP vulnerable to Video Security lapses?

No, it has nothing to do with video security, as videos get secured through cloud encoding and global distribution via a dynamic key exchange mechanism.

The post PHP implementation of VdoCipher API for Video Security appeared first on VdoCipher Blog.

]]>
https://www.vdocipher.com/blog/2014/12/php-implementation-vdocipher-api/feed/ 0
Video APIs to Automate your Video Workflow – API Version v3 https://www.vdocipher.com/blog/2018/05/video-api-v3/ https://www.vdocipher.com/blog/2018/05/video-api-v3/#respond Wed, 23 May 2018 10:27:22 +0000 https://www.vdocipher.com/blog/?p=3083 This blog suggests a workflow for automating the video workflow for your website using VdoCipher API v3. Complete details and Sample Codes for the API can be found in the Server API Docs. Our APIs are designed to give you programmatic access to VdoCipher’s service, so that you can scale your service by automating the […]

The post Video APIs to Automate your Video Workflow – API Version v3 appeared first on VdoCipher Blog.

]]>
This blog suggests a workflow for automating the video workflow for your website using VdoCipher API v3. Complete details and Sample Codes for the API can be found in the Server API Docs.

Our APIs are designed to give you programmatic access to VdoCipher’s service, so that you can scale your service by automating the video streaming workflow on your site. Our APIs make it possible for you to create programmed pipelines to automate your business operations. In this blog, you will find APIs covering most important video actions.

While the video upload and video management operations can be performed just as easily via the VdoCipher dashboard, the OTP generation needs to happen programmatically for maximum video security.

You would need to authenticate all API requests with your API keys. The Authorization header will be used to provide the API key.

Authorization: Apisecret a1b2c3d4e5

All values in the sample codes are presented in the following format – {{value}}. Replace them with the value from your website backend.

You can design your workflow with our API is as follows:

  1. Add videos to your Account
  2. Customize your Video
  3. Playback authentication and OTP Generation

Add Videos to Your Account

The upload API is especially built for users who prefer to automate their workflows around video ingestion. The upload API enables you to provide a dashboard to your content providers such that they can directly upload videos to your VdoCipher account. Alternatively the Import Video API enables you to import videos using URLs.

This is a two step process. In the first step, you obtain temporary authentication to upload a video. This also requires that you specify a title for the video in advance. In the second step the content-owner (in this case your website/app), uses the authorization tokens received from Step 1 to upload it directly to your account.

Step 1: Obtain Upload Credentials

API endpoint to send HTTP PUT request to receive upload credentials is https://dev.vdocipher.com/api/videos. To initiate video upload you would need to pass the title of video as a query string:

https://dev.vdocipher.com/api/videos?title=videotitle

This returns a JSON object, which authorizes you to initiate upload. You may upload the file yourself, or can pass the upload credentials to your content providers who can then upload videos to your account. The JSON object looks like this:

The values received in upload policy are presented in the following format – {{policy}}

{
    "clientPayload": {
        "policy": "{{format}}",
        "key": "{{key}}",
        "x-amz-signature": "{{x-amz-signature}}",
        "x-amz-algorithm": "{{x-amz-algorithm}}",
        "x-amz-date": "{{x-amz-date}}",
        "x-amz-credential": "{{x-amz-credential}}",
        "uploadLink": "https://{s3-bucket-url}}.amazonaws.com"
    },
    "videoId": "1234567890"
}

Step 2: Upload File using Obtained Credentials

The upload policy credentials JSON is used for uploading files to your VdoCipher account, using an HTTP POST request. You would create a form-data object containing the following:

  • policy
  • key
  • x-amz-signature
  • x-amz-algorithm
  • x-amz-date
  • x-amz-credential

All the above are received as part of API server response in Step 1. The request for upload credentials also returns the uploadLink URL.

In addition to the above parameters, the following need to be added:

  • success_action_status – 201
  • success_action_redirect – Set this to empty string if you do not have a specific redirect page
  • file – This is the path to the file on your content provider’s device. The file should always be appended to the end of the upload policy.

The HTTP POST request is to be made to the endpoint returned in step 1:

https://{s3-bucket-url}}.amazonaws.com'

Step 3: Check Video Status

To find the status of your video you can send an HTTP GET request to

https://dev.vdocipher.com/api/videos/{{videoID}}

The following are the status values that may be returned:

  • Pre-Upload – Upload policy has been returned (Step 1 is successful), but file is not yet uploaded (Step 2 not yet complete)
  • Queued – Video has been uploaded and is being encoded and encrypted (Step 1 and Step 2 complete)
  • ready – Video is ready for playback

Apart from video status, the video contains all details of the video. These include title, description, video upload time, video length, poster image URLs and associated tags.

{
    "id": "1234567890",
    "title": "zoo.mp4",
    "description": "",
    "upload_time": 15197xxxxx,
    "length": 25,
    "status": "ready",
    "posters": [
        {
            "width": 854,
            "height": 480,
            "posterUrl": "https://d1z78r8i505acl.cloudfront.net/poster/123456.480.jpeg"
        },
        {
            "width": 427,
            "height": 240,
            "posterUrl": "https://d1z78r8i505acl.cloudfront.net/poster/123456.240.jpeg"
        }
    ],
    "tags": [
        "abcd",
        "mnop"
    ]
}

Import Video from URL

Alternatively you may import videos directly from a URL or cloud service or a different video streaming provider. Most video streaming service providers provide API access through which you may access the original video file, to initiate video import.

Send an HTTP PUT request to the API endpoint

https://dev.vdocipher.com/api/videos/importUrl

A JSON Object containing the URL needs to be passed:

{
  "url": "{{URLString}}"
}

Customize your Videos

Our video management APIs enable you to categorize your videos according to tags for easy access. You can use a tag-based classification system to retrieve list of similar videos. This API also enables you to obtain and change the poster images of videos. Details of videos, such as encoding status, can also be found using this API.

Add new Poster Image

Poster image is the image that is shown to the viewer before a video is loaded. By default, a shot from the video at a random time is taken and converted into posters of different sizes. It may be customized to better appeal to the viewers. You can use the API to auto upload new poster images.

To use this API, send an HTTP POST request to the API endpoint:

https://dev.vdocipher.com/api/videos/{{videoID}}/files

The image file is to be sent as part of the form-data.

Add Tags

Tagging is the process of adding searchable keywords to the video. These keywords can be very helpful to retrieve any video from your dashboard or from the API. The keywords can be the name of persons in the video or the name of the collection that it belongs to. You can add multiple tags to the same video. This makes it possible for a single video to exist in multiple tags.

You would need to send an HTTP POST request to:

https://dev.vdocipher.com/api/videos/tags

The POST request body should include an array of videos, and an array of tags:

{
  "videos":[
    "{{videoID1}}",
    "{{videoID2}}"
    ],
  "tags":[
    "{{tag1}}",
    "{{tag2}}"
    ]
}

Enable tag based search

You can search for videos with a particular tag by passing the tag query parameter. The API endpoint to which you should send HTTP GET request is:

https://dev.vdocipher.com/api/videos?tag={{videoTag}}

If you are using this to display list of videos for general users to your website we recommend using it with a caching layer with large expiry time. This is because the video management APIs have soft rate-limits for number of API calls to the server.

Playback authentication with OTP generation

OTP are tokens generated using VdoCipher API which are required to authorize video playback. The OTP must always be generated on a back-end server. The generated OTP must then be sent to the website front-end. In the website front-end the OTP is used as part of the video embed code.

For valid requests the API server returns a JSON containing the otp and playbackInfo, both of which parameters you would then need to send to your website front-end as part of embed code.

To generate the OTP you need to send an HTTP POST request to the API Endpoint, with the required OTP request Header and the optional OTP request Body. This article is specific to API Version v3.

API endpoint to retrieve OTP is

https://dev.vdocipher.com/api/videos/{videoID}/otp

The API call would return a JSON object with OTP and playback info, which you would be sending to your website front-end for video playback:

{
    "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.4/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.

Find more details about VdoCipher’s DRM infrastructure and our integration of Widevine DRM for Hollywood-grade security.

The post Video APIs to Automate your Video Workflow – API Version v3 appeared first on VdoCipher Blog.

]]>
https://www.vdocipher.com/blog/2018/05/video-api-v3/feed/ 0
Using Tin Can API in video: Complete Documentation https://www.vdocipher.com/blog/2016/12/using-tin-can-api-in-video/ https://www.vdocipher.com/blog/2016/12/using-tin-can-api-in-video/#comments Mon, 26 Dec 2016 21:07:03 +0000 https://www.vdocipher.com/blog/?p=1464 Tin Can API is a specification for learning technologies that enables Learning Management Systems to collect data from various learning activities that a student may undertake. Tin Can API has succeeded SCORM (Sharable Content Object Reference Model) as the new standard for learner analytics. Requirements for Tin Can API In Tin Can API any learner […]

The post Using Tin Can API in video: Complete Documentation appeared first on VdoCipher Blog.

]]>
Tin Can API is a specification for learning technologies that enables Learning Management Systems to collect data from various learning activities that a student may undertake. Tin Can API has succeeded SCORM (Sharable Content Object Reference Model) as the new standard for learner analytics.

tin can api in video

Requirements for Tin Can API

In Tin Can API any learner activity on the web may be integrated and logged to the LMS. This includes activities such as reading a blog and watching a video online. For Tin Can API to succeed, all learning activities that a learner performs should be able to transmit learning data to the LMS.

Statements in the Tin Can API are rendered in the form Noun Verb Activity. For example if Learner A has completed watching a video on “Machine Learning: Supervised Learning Part 1”, the corresponding Tin Can API statement would be:

  • Learner A completed Machine Learning: Supervised Learning Part 1

Tin Can API with videos

The motive of Tin Can API is to have maximum feedback for user experience and act on to improve the key metrics. As in case with video, fetching in side video data becomes quite tricky owing to the variety and scale of actions performed by viewers on a video.

VdoCipher as a part of its secure video hosting service,  currently provides viewer data points on all the relevant analytics requirement for Tin Can API

Below are some of the prominent actions of viewers on video (start, pause, end, seek, progress, repeat, load, buffer, view) which are a part of Tin Can API and VdoCipher provides direct JavaScript codes for them.

It is interesting to note that there is always a debate amongst content creators and marketers on what should be taken as a view for the video ? Should just clicking on the play button be considered sufficient to be counted as a view ? Some times it is decided to take say 10 seconds of playback or 2 mins of playback as a view. With the information collected by VdoCipher’s start and progress event trackers you can easily collect viewer information for your particular definition of a video view.

Start, End, Pause, Mute, Unmute events on video player

Please check this javascript code to capture the play and pause events from the embedded video player:
<script>		
function onVdoCipherAPIReady(){
    console.log("VdoCipher API init");
    var videoObjects = vdo.getObjects();
    var video_ = videoObjects[videoObjects - 1];
    video_.addEventListener("resume", function(){
        console.log("ready event called" , video_.time);
    });
    video_.addEventListener("pause", function(data){
        // document.getElementById('totalPlayed').value = video_.totalPlayed;
    });
    }
</script>
You can similarly listen for “start”, “end” and “mute”, “unmute”.

Time Calculation per video playback

<div id="vdo<?= $OTP ?>" style="height: 300px; width: 520px;"></div>
<input type="text" id="totalPlayed" value="" />

/// this is the embed code

<script>
    (function(v,i,d,e,o){v[o]={}; v[o].a = v[o].a || 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','//de122v0opjemw.cloudfront.net/vdo.js','vdo');
    vdo.a({
        o: "<?= $OTP ?>",
    });
</script>

/// this is the script

<script>		
function onVdoCipherAPIReady(){
    console.log("VdoCipher API init");
    var videoObjects = vdo.getObjects();
    var video_ = videoObjects[0];
    video_.addEventListener("ready", function(data){
        console.log("ready event called" , data);
    });
    video_.addEventListener("progress", function(data){
        document.getElementById('totalPlayed').value = data.totalPlayed;
    });
    }
</script>
 
Note: The function wrapper with onVdoCipherAPIReady is needed only when it is part of the document load. If this script is to be run after document load, you can run it directly.
Let us know for any custom tracking functionality you require. Most of them are possible with a combination of the above scripts.

The post Using Tin Can API in video: Complete Documentation appeared first on VdoCipher Blog.

]]>
https://www.vdocipher.com/blog/2016/12/using-tin-can-api-in-video/feed/ 1
Secure Video Streaming API: VdoCipher for Developers https://www.vdocipher.com/blog/2016/09/secure-video-streaming-api-vdocipher-for-developers/ https://www.vdocipher.com/blog/2016/09/secure-video-streaming-api-vdocipher-for-developers/#respond Wed, 07 Sep 2016 10:24:37 +0000 https://www.vdocipher.com/blog/?p=695 This blog has been updated for API version v3. You may use VdoCipher API v3 to build a workflow around your video website as suggested in this blog. Complete details and Sample Codes for the API can be found in the Server API Docs. In this blog article, I’ll mention the common business use cases […]

The post Secure Video Streaming API: VdoCipher for Developers appeared first on VdoCipher Blog.

]]>
This blog has been updated for API version v3. You may use VdoCipher API v3 to build a workflow around your video website as suggested in this blog. Complete details and Sample Codes for the API can be found in the Server API Docs.

In this blog article, I’ll mention the common business use cases that generally developers use with our video streaming API. Our video APIs have been built with the express mission to automate the entire video streaming pipeline for our users, from video upload right upto video playback. The links to the new set of APIs and sample codes are also given. The complete API v3 reference, with sample codes for different backend languages, can be accessed from the API Sample Docs.

  1. Secure Video Embed

We generate dynamic URLs for video streaming. This ensures that video is played only when the API server authenticates it as being a valid session. Our API server issues unique OTPs to decrypt encrypted content. These OTPs are authenticated by the license server.

This combination of Encrypted Streaming and Backend authentication with OTP ensures that videos cannot be downloaded, and is the key feature we provide as part of our secure video streaming service.

Please visit our API page for details on embedding videos to your website. Sample codes for OTP generation can be found in the API Docs reference.

  1. Dynamic Watermark configuration

Dynamic watermarking protects your premium video content from screen capture technologies. Dynamic Watermarking enables you to display user information over the video, effectively deterring video piracy from screen capture.

You can customize user details and how the text moves across the video screen by using the Watermark API. This API always delights our users, who find that watermarking obliterates any threat from piracy.

  1. Upload from various sources

To help you manage your video content we offer various options for optimal video upload. You can upload your video files directly using the Dashboard, or by using the API. The Upload API enables you to authorize your content providers to directly upload videos to your account.

Videos can be uploaded from the desktop and from the server. The import API enables you to import videos to your VdoCipher account from any HTTP or FTP link. The Upload and Import APIs can be found at the API Docs Reference.

  1. Tagging Videos

Video tags are one of the key elements used for categorising videos. Managing a large library of videos requires that you efficiently use a tag-based video management system. The tag API enables users to effortlessly add, delete and replace tags, and to enable tag-based video search. The tagging API can be found in the API Docs.

  1. Searching Videos

The Video Search API returns a list of videos that match your query. Supported HTTP queries include title, video ID, and tags. The API returns detailed list of videos, which you can return to your website for users.

We have set soft rate limits for the search API. We recommend using a caching layer for your website’s general users, so as to limit the number of API calls.

APIs to enable video search from names and tags can be found in the API Docs.

  1. Whitelabel your Video Platform for Content Providers

Our APIs enable our users to create their own white-labelled front-end. Content providers can add videos to our client’s platform, which make upload and tagging API calls in the backend. Users can use VdoCipher’s video streaming infrastructure with their own user interface to retain complete control over user experience while delivering the best video experience for premium content.

Enterprise customers can have their own customers upload videos directly on our site. This can be implemented with APIs using these links.

This blog explains the two-step video upload process using which you can enable video uploads for content providers.

  1. Check video status

After initiating video upload you can check the status through the video status API. Apart from video status, the video contains all details of the video. These include title, description, video upload time, video length, poster image URLs and associated tags.

The following are the status values that may be returned:

  • Pre-Upload – Upload policy has been returned (Step 1 is successful), but file is not yet uploaded (Step 2 not yet complete)
  • Queued – Video has been uploaded and is being encoded and encrypted (Step 1 and Step 2 complete)
  • ready – Video is ready for playback

API reference for the video status API is available  here.

  1. Obtain and Upload Poster Image

Poster image is the image that is shown to the viewer before a video is loaded. By default, a shot from the video at a random time is taken and converted into posters of different sizes. You can customize the poster image to increase click through rates for your video. You can use the API to auto upload new poster images.

The complete API v3 reference, with sample codes for different backend languages, can be accessed from the API Sample Docs.

Video Streaming Hosting VdoCipher
All these things, VdoCipher handles for you. Launch Today.

Start a free full version 5 GB trial today at VdoCipher

Have a glimpse of the number of your viewers using video download tools for easy piracy. 

An Open Source Contribution by VdoCipher

The post Secure Video Streaming API: VdoCipher for Developers appeared first on VdoCipher Blog.

]]>
https://www.vdocipher.com/blog/2016/09/secure-video-streaming-api-vdocipher-for-developers/feed/ 0
ASP.net C# web forms embed vdocipher video https://www.vdocipher.com/blog/2016/03/asp-net-web-forms-embed-vdocipher-video/ https://www.vdocipher.com/blog/2016/03/asp-net-web-forms-embed-vdocipher-video/#respond Mon, 07 Mar 2016 13:32:55 +0000 https://www.vdocipher.com/blog/?p=453 The following code is the complete set up for embedding video in ASP.NET Web forms using vdocipher secure streaming. This code has been generated using Visual Studio Community 2015. For the MVC implementation, please check: https://www.vdocipher.com/blog/2016/02/example-code-for-streaming-protected-video-in-asp-net/ For  vbscript implementation of aspx, check this: https://www.vdocipher.com/blog/2015/01/asp-net-implementation-vdocipher-api/ Vdocipher video in asp.net: aspx and aspx.cs files: https://gist.github.com/vibhavsinha/cd81f160c6d23093aa38 Do not save API Secret in the […]

The post ASP.net C# web forms embed vdocipher video appeared first on VdoCipher Blog.

]]>
The following code is the complete set up for embedding video in ASP.NET Web forms using vdocipher secure streaming. This code has been generated using Visual Studio Community 2015.

For the MVC implementation, please check: https://www.vdocipher.com/blog/2016/02/example-code-for-streaming-protected-video-in-asp-net/

For  vbscript implementation of aspx, check this: https://www.vdocipher.com/blog/2015/01/asp-net-implementation-vdocipher-api/

Vdocipher video in asp.net: aspx and aspx.cs files:

https://gist.github.com/vibhavsinha/cd81f160c6d23093aa38

Do not save API Secret in the code

API secret is a key which gives your website authority to generate access tokens (OTPs) for video playback. This secret key can also be used to upload, delete videos in your vdocipher account. Hence, it should not be hard-coded in the application. It should be kept as an app secret. In the above example, it has been added to the web.config file which is not the recommended method. Please read this official article on best practices of saving secret keys in ASP.NET.

Complete code

Download the complete sample application from the Github.

Adding watermark to the videos

Watermark can be added when generating the OTP in the controller file. Please read this article on structuring your watermark and a sample code. The watermark has to be URL-encoded and sent as post data. You shall need to change around line 33 to send annotation information. Let us know if you find any trouble with the watermark setup.

A note about caching

OTP generated here is temporary. You can not cache this OTP and send it to multiple users as it might cause trouble. The OTP once used gets expired and can no longer be used to play video. Some extensions might try to automate the page rendering and especially when on pages that do not need login. The configuration must be set to make sure pages with embedded videos are not cached and cause error while playback.

vdocipher api illustration

For reference about how everything works, please check API reference.

Do let us know about your experiences setting up your secure video in asp.net to create your own PPV or subscription-based video portal. and how we can make the integration simpler.

FAQs

Is it secure to embed Videos in ASP.net web forms?

It is completely secure when using a DRM protected service like VdoCipher and follows the above best practices guide for saving secret keys in ASP.NET

What is required to protect videos in ASP.Net Web-forms?

DRM protected Video Hosting providers like VdoCipher and a guide to embedding like this.

How to apply a watermark on Video in ASP.Net?

Watermark can be added to the secure and smart HTML5 player. Do read our article on “Adding text via watermark” for structuring your watermark and a sample code.

The post ASP.net C# web forms embed vdocipher video appeared first on VdoCipher Blog.

]]>
https://www.vdocipher.com/blog/2016/03/asp-net-web-forms-embed-vdocipher-video/feed/ 0
Drupal module to embed VdoCipher videos https://www.vdocipher.com/blog/2016/02/drupal-module-to-embed-vdocipher-videos/ https://www.vdocipher.com/blog/2016/02/drupal-module-to-embed-vdocipher-videos/#respond Thu, 11 Feb 2016 00:02:47 +0000 https://www.vdocipher.com/blog/?p=440 Your videos on VdoCipher are protected and can only be played by an access token for each video view. This access token needs to be generated securely in your website backend. VdoCipher’s Drupal module handles this, making sure that you need only a single-line shortcode to add videos to your Drupal site. Behind the scenes the module […]

The post Drupal module to embed VdoCipher videos appeared first on VdoCipher Blog.

]]>
Your videos on VdoCipher are protected and can only be played by an access token for each video view. This access token needs to be generated securely in your website backend. VdoCipher’s Drupal module handles this, making sure that you need only a single-line shortcode to add videos to your Drupal site.

Behind the scenes the module uses a shortcode-like syntax to parse and display videos. Videos can be displayed inside any node such as an article or a page or a custom content type. The markup of the content body is processed and the shortcode syntax is replaced with the player code.

Download here

  1. Download the module file from the link above.
  2. Upload the module file from the install new module page in your Drupal “install new module” page.
  3. Enable the uploaded module.
  4. Click on the configure link in the module page to complete your setup.
  5. Copy your API secret key from VdoCipher Dashboard > Config > General.
  6. Enter the API key in Drupal and save your settings.
  7. Save the configuration.
  8. Copy a video id from your VdoCipher dashboard. Edit an existing node in Drupal and add this code in any text field (replace 123456789 with id of a video).
    [vdo id=123456789]
  9. Open the article on a page. You should see the video player in your Drupal website.

Note on watermark adding.

The watermark can be added to your videos to imprint info about the logged in user or an image for branding. You can configure the watermark from the module configuration page. Check this article for more information on the structure and format required to add watermark text or image in the video. Please note that Drupal-7.x does not provide any APIs to get current user, for which reason the user name, user ID and user email cannot be configured in watermark. Our license server can identify the IP requesting the video with the date. A sample request using both IP address and date in the watermark is as follows

[{'type':'rtext','text':'[ip] [date.h:i:s A]','alpha':'0.8', 'color':'0xFF0000', 'size':'15', 'interval':'5000', 'skip':'2000'}]

A note about caching

OTP generated here is temporary. You can not cache this OTP and send it to multiple users as it might cause trouble. The OTP once used gets expired and can no longer be used to play video. Some extensions might try to automate the page rendering and especially when on pages which do not need login. The configuration must be set to make sure pages with embedded videos are not cached and cause error while playback.

For reference about how everything works, please check API reference.

Drupal FAQ

Q. I am seeing the message: Unauthorized
A. Most probably, you have extra spaces in the API key configuration. Go to the module configuration for VdoCipher and make sure the API key is correct.

Q. I am seeing message: Video not found
A. This would probably mean that the video id is not correct. The rich-text editor you are using to add the shortcode might have added extra characters. Content saved in the database is HTML while you are shown rendered HTML in the editor. Click on one of the “view source” option in your editor and try re-pasting the shortcode. Also, make sure there are no spaces before or after the equality sign.

Q. How to set this up for selling video as PPV or subscription?
A. The video can only be viewed by the person who has purchased a membership or a video. You need to set up Drupal permissions such as only those persons can view the assigned content-type which has video.

Q. The height and width are not what I want
A. The height and width are taken from the module configuration and overridden from the shortcode. Did I tell you, you can also add the height and width info like the following. In case the provided width is greater than the available width, the width is set to 100% of available width and height is adjusted to keep the same aspect ratio as provided by the settings.

Q. Why is this not integrated with the media module
A. That what was the idea when we started working on it. But turns out there are certain permission concerns that we need to understand to make sure that using the media module is alright for your video accessibility.

Q. How to manage permission on creating video playable contents
A. The shortcode for video can be added to any node and thus anybody who has the permission to create node(any content type) can add a shortcode to play the video. Note that comment is not a node. We understand this might be a problem for your set-up in a multi-user environment. We plan to solve this problem in the next version with either a custom content type or using the media module to make it easy to control permissions. At the very least, we can add a white-list of content-types which can only have a video embedded in it but it might not work in all cases.

Do let us know about your experiences setting up your secure video in Drupal to create your own PPV or subscription-based video portal. and how we can make the integration simpler.

 

The post Drupal module to embed VdoCipher videos appeared first on VdoCipher Blog.

]]>
https://www.vdocipher.com/blog/2016/02/drupal-module-to-embed-vdocipher-videos/feed/ 0
Code to embed vdocipher video in ASP.NET MVC with C# https://www.vdocipher.com/blog/2016/02/example-code-for-streaming-protected-video-in-asp-net/ https://www.vdocipher.com/blog/2016/02/example-code-for-streaming-protected-video-in-asp-net/#comments Mon, 08 Feb 2016 13:04:10 +0000 https://www.vdocipher.com/blog/?p=434 The following code is the complete set up for embedding video in ASP.NET MVC using vdocipher secure streaming. This code has been generated using Visual Studio Community 2015. Vdocipher video in asp.net: controller view and config files https://gist.github.com/vibhavsinha/c82239fea15888afd75b Do not save API Secret in the code API secret is a key which gives your website authority to […]

The post Code to embed vdocipher video in ASP.NET MVC with C# appeared first on VdoCipher Blog.

]]>
The following code is the complete set up for embedding video in ASP.NET MVC using vdocipher secure streaming. This code has been generated using Visual Studio Community 2015.

new asp.net create dialog for video in asp.net

Vdocipher video in asp.net: controller view and config files

https://gist.github.com/vibhavsinha/c82239fea15888afd75b

Do not save API Secret in the code

API secret is a key which gives your website authority to generate access tokens (OTPs) for video playback. This secret key can also be used to upload, delete videos in your vdocipher account. Hence, it should not be hard-coded in the application. It should be kept as an app secret. In the above example, it has been added to the web.config file which is not the recommended method. Please read this official article on best practices of saving secret keys in ASP.NET.

Complete code

Download the complete sample application from the Github.

Adding watermark to the videos

Watermark can be added when generating the OTP in the controller file. Please read this article on structuring your watermark and a sample code. The watermark has to be URLencoded and sent as a post data. You shall need to change around line 33 to send annotation information. Let us know if you find any trouble with the watermark setup.

A note about caching

OTP generated here is temporary. You can not cache this OTP and send it to multiple users as it might cause trouble. The OTP once used gets expired and can no longer be used to play video. Some extensions might try to automate the page rendering and especially when on pages which do not need login. The configuration must be set to make sure pages with embedded videos are not cached and cause error while playback.

vdocipher api illustration

For reference about how everything works, please check API reference.

Do let us know about your experiences setting up your secure video in asp.net to create your own PPV or subscription-based video portal. and how we can make the integration simpler.

The post Code to embed vdocipher video in ASP.NET MVC with C# appeared first on VdoCipher Blog.

]]>
https://www.vdocipher.com/blog/2016/02/example-code-for-streaming-protected-video-in-asp-net/feed/ 1
Load video files from public ftp server https://www.vdocipher.com/blog/2016/02/load-video-files-from-public-ftp-server/ https://www.vdocipher.com/blog/2016/02/load-video-files-from-public-ftp-server/#respond Thu, 04 Feb 2016 07:47:20 +0000 https://www.vdocipher.com/blog/?p=427 Videos upload from local computer can be a tedious job unless you have a very good upload speed. Often our customers have to upload TBs of content from their public servers. Here we list two methods of load videos directly from your servers to your VdoCipher account. Option 1: FTP upload This option requires your server […]

The post Load video files from public ftp server appeared first on VdoCipher Blog.

]]>
Videos upload from local computer can be a tedious job unless you have a very good upload speed. Often our customers have to upload TBs of content from their public servers. Here we list two methods of load videos directly from your servers to your VdoCipher account.

Option 1: FTP upload

This option requires your server to expose ftp access from public servers.

  • Go to your dashboard and choose import from FTP. Enter the server ip, username and password to login to your server.
  • You shall see a list of files on your home account of ftp server. Navigate to the folders using breadcrumbs.
  • When there will be a video file, you can see an import button. Click on the import button to import the video.

After import, these videos will now be reflected on your dashboard. It shall take some time for the video to get ready. You can also poll the API to know the processing state.

Option 2: HTTP URL

If your server is capable of generating http URL to the video files, you can use the url import feature to add videos to your VdoCipher account.

  • Generate publicly accessible http(s) URLs to the videos. Make sure these videos are accessible for at least next 48 hours.
  • Login to your VdoCipher account and choose import from url.
  • Enter the list of urls with line break as delimiter.
  • Click import button and wait for message box to display the status. These videos shall be added to your account and will take time to process.

If the above methods does not work for your case, let us know in the comments below.

The post Load video files from public ftp server appeared first on VdoCipher Blog.

]]>
https://www.vdocipher.com/blog/2016/02/load-video-files-from-public-ftp-server/feed/ 0