Cloud Video Kit follows a module architecture. Depending on your plan and needs, you will have access to all or only some of the modules. Each module has its own API. Cloud Video Kit provides APIs for the following modules:
- VOD - Upload video files, transcode them, and manage your VOD files
- Live - Manage live channels and events
- Recorder - Record live events and make highlights to build your video library out of live feed
- Streaming - Guides on how to stream assets created in Cloud Video Kit
- DRM - Protect the video content with industry-leading encryption methods
The sample requires Node version 18 or higher.
Installation:
npm install
npm run startThe provided sample application demonstrates how to call the Cloud Video Kit REST API. The application includes an Express.js web server responsible for forwarding calls to the Cloud Video Kit API. The frontend part of the application is a simple HTML page with JavaScript code that calls the server-side API.
To call the service API, you will need the following information:
- API key - available at the API Cheatsheet page
- tenant name
Before starting the application, ensure that you have filled in your .env file.
- Inital setup: The server-side of the application works as a proxy and passes the request to the Cloud Video Kit API with the provided API key.
- The application retrieves a list of acceptable file extensions from Cloud Video Kit (
/vod/filetypes). - The uploading process begins on the frontend side by sending a
/vod/startrequest with the file size, file name, and friendly name. In response, the frontend receives:fileId: a unique identifier for the filepartsCount: the number of parts the file needs to be uploaded inmultipartUrls: a list of URLs for uploading file parts. If the list is shorter than thepartsCount, additional URLs need to be fetched from another endpoint.uploadId: a unique identifier for the uploadpartSize: the size of each file chunk to upload
- File parts are uploaded based on the initial request (
multipartUrlsfield from/vod/startrequest). - If
partsCountis greater than the number of parts provided in themultipartUrlsfield, the missing URLs need to be downloaded from another endpoint. Fetch the missing URLs from/files/FILE_ID/part/PART_NUMBER. - Upon uploading every part of the file, complete the process by sending a POST request to
/vod/files/complete/with:fileId: the file IDparts: an array of objects containing propertiespartNumberandeTagfrom the response of every uploaded part.
In the provided example, multiple file parts are uploaded simultaneously to expedite the process.
- The application fetches the latest 5 VODs (full documentation for VOD API you can find here: https://docs.videokit.cloud/api-reference/api-reference#vod-1)
async function getVods(token) {
const response = await fetch(
`https://TENANT_NAME.api.videokit.cloud/vod/v1/assets?limit=5&page=1&sort=lastModificationDate&desc=true`,
{ headers: { "X-Api-Key": API_KEY } }
);
const { items } = await response.json();
return items;
}- The application looks for unprotected VODs with HLS manifests
- If such a VOD is available, the VOD title and HLS manifest URL are added to the page returned by the server