Skip to content

Instantly share code, notes, and snippets.

@vibhavsinha
Created January 16, 2015 23:45
Show Gist options
  • Save vibhavsinha/8029efcf0b66016f8040 to your computer and use it in GitHub Desktop.
Save vibhavsinha/8029efcf0b66016f8040 to your computer and use it in GitHub Desktop.
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
Using client As New Net.WebClient
Dim reqparm As New Specialized.NameValueCollection
reqparm.Add("clientSecretKey", "*********** ENTER CLIENT SECRET KEY ***********")
Dim responsebytes = client.UploadValues(strGetURL, "POST", reqparm)
Dim responsebody = (New Text.UTF8Encoding).GetString(responsebytes)
strResult = responsebody
End Using
Return strResult
End Function
'
Public Function vdocipher_player(strVideoID As String) As String
Dim strOtp As String
Dim strVideoCode As String = ""
Dim strHeight As String = 480
Dim strWidth As String = 720
strOtp = vdocipher_sendCommand("otp", "video=" + strVideoID)
strOtp = strOtp.Substring(8, strOtp.Length - 10)
If Not strOtp Is Nothing Then
strVideoCode = "<div id='vdo" + strOtp + "' ></div>"
strVideoCode += "<scr" + "ipt src='https://de122v0opjemw.cloudfront.net/utils/playerInit.php?otp=" + strOtp + "&height=" + strHeight + "&width=" + strWidth + "'></" + "scr" + "ipt>"
End If
Return strVideoCode
End Function
Protected Sub VdoCipher_Load(sender As Object, e As EventArgs) Handles Me.Load
'Output the result using asp.net literal control
litVdoCipher.Text = vdocipher_player("****** VIDEO ID GOES HERE *********")
End Sub
End Class
@vibhavsinha
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment