C# vdocipher Archives - VdoCipher Blog Secure Video Streaming Thu, 18 Jan 2024 09:50:41 +0000 en-US hourly 1 https://wordpress.org/?v=6.4.5 https://www.vdocipher.com/blog/wp-content/uploads/2016/11/cropped-VdoCipher-logo2-32x32.png C# vdocipher Archives - VdoCipher Blog 32 32 C# sample API for video upload from browser to VdoCipher https://www.vdocipher.com/blog/2022/09/c-sample-video-upload-from-browser-to-vdocipher/ https://www.vdocipher.com/blog/2022/09/c-sample-video-upload-from-browser-to-vdocipher/#respond Fri, 02 Sep 2022 15:01:09 +0000 https://www.vdocipher.com/blog/?p=438 To automate your video website platform, you need video upload directly through your website. Read this for details about this method. The following code gives an example written in C#. C# Sample Code​ for VdoCipher OTP Generation In this example, the sample videoID is 1234567890, and the API Secret Key is a1b2c3d4e5. The time-to-live for OTP validity is set to […]

The post C# sample API for video upload from browser to VdoCipher appeared first on VdoCipher Blog.

]]>
To automate your video website platform, you need video upload directly through your website. Read this for details about this method. The following code gives an example written in C#.

C# Sample Code​ for VdoCipher OTP Generation

In this example, the sample videoID is 1234567890, and the API Secret Key is a1b2c3d4e5. The time-to-live for OTP validity is set to 300s in the sample code. You can reference the API documentation for more info.

var client = new RestClient("https://dev.vdocipher.com/api/videos/1234567890/otp");
var request = new RestRequest(Method.POST);
request.AddHeader("Accept", "application/json");
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Apisecret a1b2c3d4e5");
request.AddParameter("undefined", "{\n\t\"ttl\":300\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

The controller makes an API request to VdoCipher API to get authorized data about the upload. View file creates the HTML form required for uploading data. Note that the HTML form is only for illustration. You need to hide the extra input fields and perhaps use one of the better javascript libraries (angularjs, jquery or standalone, etc.) for video upload to make user flow better according to rest of your website.

https://gist.github.com/vibhavsinha/cb35c43b874e52c69dd2

After the video is uploaded, it is not ready instantly. Do not load the player immediately. Use the API to query when video is ready and only then render the video player. The API for querying video status is described in the API reference as videos.

FAQs

How to protect your C# video streaming on the backend?

The security integration of video streaming, like multi-DRM, is not directly available for C# use. The easiest solution would be to use a secure video streaming service provider like VdoCipher and integrate with their APIs compatible with the C# backend.

How to secure API in C#?

API gets used as a documented method of interacting with other services, and that is why there is no exact answer to the question, but applying OAuth and using a shared secret along with the request made can work as generic solutions.

Is C# vulnerable to Video Security lapses?

No, it has nothing to do with video security, as videos get secured through cloud encoding and global distribution via a dynamic key exchange mechanism.

 

The post C# sample API for video upload from browser to VdoCipher appeared first on VdoCipher Blog.

]]>
https://www.vdocipher.com/blog/2022/09/c-sample-video-upload-from-browser-to-vdocipher/feed/ 0