Created
January 16, 2015 23:45
-
-
Save vibhavsinha/8029efcf0b66016f8040 to your computer and use it in GitHub Desktop.
ASP.NET implementation of VdoCipher
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Credits: https://www.katieandemil.com/vdocipher-api-asp-net-implementation-code