- Upload Videos though URL to Microsoft's Video Indexer API.
- Get Insights about the video
- Get Information about Sentimenta, faces , Characters ,transcipts
- Captions from videos
- Thumbnails of videos in "JPEG" or "Base64" .
- Error handling.
// CommonJS
const VideoIndexer = require('./Video_indexer/index');
// ES Module
import VideoIndexer from './Video_indexer/index';
Before Starting to use need you will need to get and store the belowe mentioned stuffs:
- Login to https://api-portal.videoindexer.ai/developer and get the Subscription Key
- Go to https://www.videoindexer.ai/settings/account and get the Account Id and loacation
- Store the keys somewhere.
// Basic configuration
const Subscription_Key="Your-subscription-key";
const Account_Id="Your-Azure's-account-Id";
const Location="Your-location(Example:'trail')"
// Instantation
const vi = new VideoIndexer(Subscription_Key ,Account_Id ,Location)
Any video can can be uploaded through its URL. After Successfull upload ,promise iis returned which can be resolved to get videoId . This Id received can be used to get other information from video.
Only HTTPS Video URL is supported (HTML or any other types are not supported)
// Uploading video
vi.upload_video_to_indexer({
videoUrl:"Url(https) of the video to upload" // Compulsory,
language:"English or any other", // Optional(Default:"English"),
name:"video-name" // Optional
})
.then(res=>{
console.log("Video Id:",res.videoId)
})
.catch(err=>{
console.log(err.response.data)
})
// Getting info
vi.get_video_index({
videoId:"Uploaded video's Id", // Required
language: "English or any other", // Default : English
})
.then(data=>{
console.log(data)
// Processing Progress :
console.log(data.videos[0].processingProgress)// 80% ..100%
})
.catch(err=>{
console.log(err.response.data)
})
Note :Insights won't be generated untill video is processed completely(In case uploading and getting index are called back to back).
vi.get_video_caption({
videoId:"Uploaded video's Id", // Required
format:"vtt or txt or csv or srt " // Default: vtt
language: "English or any other", // Default : English
})
.then(res=>{
console.log(res.data)
})
.catch(err=>{
console.log(err.response.data)
})
vi.get_video_thumbnails({
videoId:"Uploaded video's Id", // Required
format:" jpeg || base64" // Default:jpeg
})
.then(res=>{
console.log(res.data)
})
.catch(err=>{
console.log(err.response.data)
})