Skip to content

Instantly share code, notes, and snippets.

View vibhavsinha's full-sized avatar

Vibhav Sinha vibhavsinha

View GitHub Profile
@vibhavsinha
vibhavsinha / About.aspx
Created March 7, 2016 12:48
Sample implementation of vdocipher secure video embeddding in a ASP.NET web forms application Raw About.aspx
<%@ Page Title="About" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="About.aspx.cs" Inherits="WebApplication2.About" %>
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
<h2><%: Title %></h2>
<h3>Your application description page.</h3>
<p>Use this area to provide additional information.</p>
<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];
@vibhavsinha
vibhavsinha / php_sample_browser_upload.php
Last active March 1, 2016 08:39
Upload from your browser in PHP
<?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));
}
@vibhavsinha
vibhavsinha / WebApplication1\Controllers\HomeController.cs
Created February 8, 2016 14:45
Sample code for browser video upload from ASP.NET with C#
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Mvc;
@vibhavsinha
vibhavsinha / WebApplication1\Controllers\HomeController.cs
Created February 8, 2016 11:54
Sample code to embed vdocipher videos with C# in ASP.NET MVC
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Mvc;
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Sample</title>
</head>
<body>
<hr />
<div id="vdo{{OTP}}" style="height: 300px; width: 520px;"></div>
<input type="text" id="totalPlayed" value="" />
<button onclick="start()">Start</button>
@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>
@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 / 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 / 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)