Skip to content

Instantly share code, notes, and snippets.

@vibhavsinha
Last active August 29, 2015 14:12
Show Gist options
  • Save vibhavsinha/ffae3259b43647e85829 to your computer and use it in GitHub Desktop.
Save vibhavsinha/ffae3259b43647e85829 to your computer and use it in GitHub Desktop.
A simple implementation in Classic ASP. Also including annotation.
<!--#include file="VdoCipherSDK.asp"-->
<!DOCTYPE html>
<html>
<head>
<title>SDK ASP Example</title>
</head>
<body>
<p>A text before video</p>
<%
set videoObject = new VDO
videoObject.id = "VIDEO_ID"
videoObject.height = "400"
videoObject.width = "640"
videoObject.annotation = "[{'type':'rtext', 'text':'moving text', 'alpha':'0.8', 'color':'0xFF0000', 'size':'12','interval':'5000'}, {'type':'text', 'text':'static text', 'alpha':'0.5' , 'x':'10', 'y':'100', 'color':'0xFF0000', 'size':'12'}]"
videoObject.play()
%>
<br />
A text after the video
</body>
</html>
<%
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)
if Not ServerXmlHttp.status = 200 Then
Call Err.Raise(60001, "vdocipher", "Invalid Response from server " + CStr(ServerXmlHttp.status))
End If
If Not InStr(ServerXmlHttp.ResponseText, "No Video Found") = 0 Then
Response.Write("Please contact us.")
Set vdocipher_sendCommand = Nothing
Else
Set vdocipher_sendCommand = ServerXmlHttp.ResponseXML
End If
End Function
Class VDO
Public title
Public otp
Public height
Public width
Public id
Public annotation
Public Sub play()
Set otp = vdocipher_sendCommand("otp", "video="+id, "annotate="&Server.URLEncode(annotation))
if not IsNull(otp) Then
otp_value = otp.getElementsByTagName("otp").item(0).text
Response.Write("<div id='vdo"+ otp_value +"' ></div>")
Response.Write("<scr"+"ipt src='https://de122v0opjemw.cloudfront.net/utils/playerInit.php?otp="+otp_value+"&height="+height+"&width="+width+"'></"+"scr"+"ipt>")
End If
End Sub
End Class
%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment