ArvanCloud VOD Service Panel and API User Guide
The following chart illustrates ArvanCloud’s VOD service structure and its workflow.
ArvanCloud’s VOD service can be utilized through one of these two methods:
- Through ArvanCloud User Panel
- Through API (for developers)
Creating a Domain
When you open the ArvanCloud user panel for the first time, you will be asked to choose a subdomain. If the specified subdomain is not already taken, it will be assigned to you. Your videos will be accessible via this domain which looks like the following address:
Please note that once assigned, this subdomain can not be changed or edited.
This panel consists of seven sections:
Dashboard: Statistics of the service, such as the number of channels, videos, conversions, and traffic, are provided in this section.
Channels: To use the VOD platform’s features, you first need to create a channel. This section is where the channels can be created and managed.
Videos: You can add or manage each channel’s videos through this section. There are also the following features included in the videos section:
Input: An input can be provided through uploading the file or using an external URL. Acceptable formats include MP4, AVI, and M4V, which both extension and mime-type of the input file should be compatible with them.
Output type: Includes three modes, Automatic, profile, and manual. In automatic mode, your video will be analyzed and based on the results, the quality of output will be determined. Profile mode will offer the qualities you have already specified in your profile, and manual mode needs you to manually enter your desired qualities.
Cover photo: You can upload a photo or use a specific part of the video as the cover photo. This photo will be shown before the video is played in the player.
Watermark: You can insert a watermark, which is already created, to your video.
Subtitle: You can import a subtitle and choose its language here, in case needed. The supported format for a subtitle is WebVTT.
Real-time Conversion: While the videos are normally being converted through a queue, using this feature, the video will be converted at the same time with the other videos, without entering a queue. This feature is not free, and its cost will be deducted from your wallet. There is a three video at the same time limit activated for all services. In case you need more than this number of videos to be converted, you need to contact ArvanCloud customer support.
Temporary Videos: Every uploaded video will first be uploaded in this section and, with a successful conversion, will be deleted. If there are too many videos to convert, you can upload them to the temporary videos section first, and after choosing details like name and output type, proceed to the conversion stage. Every video will only remain in this section for 48 hours, and in case they are not used, they will be removed automatically.
Watermark: You can create watermarks in this section.
Profile: You can define different profiles in this section of the VOD panel. Each profile can contain details like output quality and cover photo. Having profiles helps you avoid specifying repetitive information over and over.
Reports: All reports of your domain are provided in this section.
ArvanCloud video service’s API uses Rest architecture. It consists of the following groups:
- General Report
To use each section’s API, you need to meet some specific requirements, as shown above. For instance:
- To use Reports and Channels APIs, you need to submit a domain.
- To use Video, Temporary Videos, Profile, and Watermark APIs, you need to create a channel.
- To use Subtitle APIs, you need to create a video.
The first step to use an API is authentication. To do so, you need to enter your API Key in the Authorize part of the panel.
As the other APIs are easy to work with, we will talk about the Temporary Video section’s APIs in this section.
ArvanCloud VOD service uses tus protocol for file upload, which provides features like resume in the upload. The easiest path to take is to use open-source, tus libraries that are provided for various languages.
In case you are not willing to use prepared libraries, you can do this part yourself, if you have a good command on tus protocol; However, ArvanCloud does not recommend this method and will not be responsible for any problems in this regard.
In this part, we will look at how a file is uploaded as an example.
To start the upload, you need to call the post method and import the following in its header:
TUS-resumable: tus version. Currently, you can use 1.0.0.
Upload-length: The size of the sent file in Byte.
Upload-metadata: A combination of filename and filetype. Metadata of an example file, test.mp4 looks like the following:
Base64(test.mp4) ⇒ dGVzdC5tcDQ=
Base64(video/mp4) ⇒ dmlkZW8vbXA0
metadata ⇒ filename dGVzdC5tcDQ=,filetype dmlkZW8vbXA0
Success in this step will result in fetching 201 code as well as the created file’s location in the response header. This address will be used in the next steps.
In this step, you need to import a portion of your desired file in the payload and tus-resumable and upload-offset in the header. It should be sent to the location fetched in the last step. Upload-offset’s value should be equal to the amount of sent Bytes to the sever, it would be 0 in the first request.
A successful request will be responded with a 204 code and the value of the upload-offset. When all files are successfully sent to the server, the upload-offset value is equal to upload-length.
The easiest but not necessarily the best way is to use this sending file section as a whole. In this method, you put the whole file in the first request and send it to the server. Of course, there might be some issues like Internet disconnection that will result in problems in sending the file. In these cases, you need to repeat this step.
To use this sample code, you first need to install tus-js-client package and replace the following sections in the sample code:
Path to tus.js with the installed tus.js file address.
ChannelId: the ID of the channel already created.
Authorization: The API Key created in previous steps.