Skip to content

Instantly share code, notes, and snippets.

View vibhavsinha's full-sized avatar

Vibhav Sinha vibhavsinha

View GitHub Profile
@vibhavsinha
vibhavsinha / decode.as
Last active December 9, 2015 15:15
Raw binary Communication between actionscript and javascript
protected function decode(str:String):ByteArray
{
var alphabet:String = 'abcdefghijklmnopqrstuvwxyz'; // only first 16 chars used
var lookup:Object = new Object;
var len:Number = str.length;
var enc:Array = [0,0];
var result:ByteArray = new ByteArray;
if(str.length % 2)
throw new Error("Decode failed: The string is not correctly encoded.");
var position:Number = -1;
@vibhavsinha
vibhavsinha / vdocipherJsCallStatusDemo.html
Last active August 29, 2015 14:02
A demo for vdoCipher javascript
<script type="text/javascript">
function callStatus(){
var vdo = vdocipher_videos[0];
logbox.value = (typeof(vdo) == "undefined" || typeof(vdo.status) == "undefined") ? -1 : vdo.status;
}
</script>
<input type="text" value="" id="logbox" />
<button onclick="callStatus()">Check Status</button>
@vibhavsinha
vibhavsinha / example.php
Last active September 10, 2022 21:40
VdoCipher API implementation in PHP
<?php
/**
* This code can be used in your controller or view
* file to display the video player
* PHP Version 5.5
*
* @category Api
* @package Vdocipher
* @author Vibhav Sinha <[email protected]>
* @license MIT https://tldrlegal.com/license/mit-license
@vibhavsinha
vibhavsinha / vdo_api_annotate.php
Last active March 5, 2016 06:07
VdoCipher API implementation in PHP with adding watermark
<?php
function send($action, $params, $posts = false){
$curl = curl_init();
curl_setopt($curl, CURLOPT_FAILONERROR, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_VERBOSE, true);
curl_setopt($curl, CURLOPT_FAILONERROR, false);
$getData = http_build_query($params);
@vibhavsinha
vibhavsinha / VdoCipherSDK.asp
Last active August 29, 2015 14:12
A simple implementation in Classic ASP. Also including annotation.
<%
Public Function vdocipher_sendCommand(action, getData, postFields)
clientSecretKey = "CLIENT_SECRET_KEY"
Set ServerXmlHttp = Server.CreateObject("MSXML2.ServerXMLHTTP.6.0")
ServerXmlHttp.open "POST", "http://api.vdocipher.com/v2/" + action + "?"+getData + "&type=xml"
ServerXmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
postData = "clientSecretKey="+ clientSecretKey + "&" +postFields
ServerXmlHttp.send(postData)
@vibhavsinha
vibhavsinha / vdocipher_apiSample.php
Created December 29, 2014 16:53
VdoCipher search and display video based on the name of file uploaded or the title of the video
<?php
function send($action, $params){
$curl = curl_init();
curl_setopt($curl, CURLOPT_FAILONERROR, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_VERBOSE, true);
curl_setopt($curl, CURLOPT_FAILONERROR, false);
$getData = http_build_query($params);
@vibhavsinha
vibhavsinha / vdocipher_APi.aspx
Created January 16, 2015 23:45
ASP.NET implementation of VdoCipher
Imports System.Net
Imports System.IO
Partial Class VdoCipher
Inherits System.Web.UI.Page
' A function to interact with API server based paramaters
Public Function vdocipher_sendCommand(action As String, getData As String) As String
Dim strGetURL As String = "http://api.vdocipher.com/v2/" + action + "?" + getData
Dim strResult As String
@vibhavsinha
vibhavsinha / example_form.php
Last active October 13, 2020 23:01
VdoCipher upload API example in PHP
<?php
include("vdocipher_api.php");
vdo_uploadForm();
/// To use the tags, pass as an argument. Note that this is optioinal
/*
vdo_uploadForm(array(
'tags'=>array('tag1', 'tag2'),
));
*/
@vibhavsinha
vibhavsinha / Embed code.html
Last active September 7, 2015 12:59
Asynchronous vdocipher video embed code
<div id="vdo%OTP%" style="height:400px;width:640px;max-width:100%;"></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','//de122v0opjemw.cloudfront.net/vdo.js','vdo');
vdo.add({
o: "%OTP%",
});
</script>