Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@api.video/nodejs-sdk
Advanced tools
api.video is an API that encodes on the go to facilitate immediate playback, enhancing viewer streaming experiences across multiple devices and platforms. You can stream live or on-demand online videos within minutes.
The api.video web-service helps you put video on the web without the hassle. This documentation helps you use the corresponding NodeJS client.
npm install @api.video/nodejs-sdk
const apiVideo = require('@api.video/nodejs-sdk');
(async () => {
try {
// Create client for Production and authenticate
const client = new apiVideo.Client({ apiKey: 'xxx' });
// Create and upload a video ressource
const video = await client.videos.upload('test/data/small.webm', { title: 'Course #4 - Part B' });
console.log(video);
} catch (e) {
console.error(e);
}
})();
See sandbox.spec.js for more usage examples.
/**
* VIDEO
*/
const client = new apiVideo.Client({ apiKey: 'xxx' });
// Show a video
client.videos.get(videoId);
// Show a video status
client.videos.getStatus(videoId);
// List or search videos
client.videos.search(parameters = {});
// Create video properties
client.videos.create(title, properties = {});
// Upload a video media file
// Create a video, if videoId is null
client.videos.upload(source, properties = {}, videoId = null);
// Create a video by downloading it from a third party
client.videos.download(source, title, properties = {});
// Update video properties
client.videos.update(videoId, properties);
// Set video public
client.videos.makePublic(videoId);
// Set video private
client.videos.makePrivate(videoId);
// Delete video (file and data)
client.videos.delete(videoId);
// Delegated upload (generate a token for someone to upload a video into your account)
result = client.tokens.generate(); // string(3): "xyz"
result.then(function(token) {
// ...then upload from anywhere without authentication:
// curl https://ws.api.video/upload?token=xyz -F file=@video.mp4
});
/**
* VIDEO THUMBNAIL
*/
// Upload a thumbnail for video
client.videos.uploadThumbnail(source, videoId);
// Update video's thumbnail by picking timecode
client.videos.updateThumbnailWithTimecode(videoId, timecode);
/**
* VIDEO CAPTIONS
*/
// Get caption for a video
client.videos.captions.get(videoId, language);
// Get all captions for a video
client.videos.captions.getAll(videoId);
// Upload a caption file for a video (.vtt)
client.videos.captions.upload(source, properties);
// Set default caption for a video
client.videos.captions.updateDefault(videoId, language, isDefault);
// Delete video's caption
client.videos.captions.delete(videoId, language);
/**
* VIDEO CHAPTERS
*/
// Get caption for a video
client.videos.chapters.get(videoId, language);
// Get all chapters for a video
client.videos.chapters.getAll(videoId);
// Upload a chapter file for a video (.vtt)
client.videos.chapters.upload(source, properties);
// Delete video's chapter
client.videos.chapters.delete(videoId, language);
/**
* PLAYERS
*/
// Get a player
client.players.get(playerId);
// List players
client.players.search(parameters = {});
// Create a player
client.players.create(properties = {});
// Update player's properties
client.players.uploadLogo(source, playerId, link);
// Update player's properties
client.players.update(playerId, properties);
// Delete a player logo
client.players.deleteLogo(playerId);
// Delete a player
client.players.delete(playerId);
/**
* LIVE
*/
// Show a live
client.lives.get(liveStreamId);
// List or search lives
client.lives.search(parameters = {});
// Create live properties
client.lives.create(name, properties = {});
// Update live properties
client.lives.update(liveStreamId, properties);
// Delete live (file and data)
client.lives.delete(liveStreamId);
/**
* LIVE THUMBNAIL
*/
// Upload a thumbnail for live
client.lives.uploadThumbnail(source, liveStreamId);
/**
* ANALYTICS
*/
// Get video analytics between period
client.analyticsVideo.get(videoId, period);
// Get live analytics between period
client.analyticsLive.get(liveStreamId, period);
// Get analytics session events
client.analyticsLive.get(sessionId, parameters);
Function | Parameters | Description | Required | Allowed Values |
---|---|---|---|---|
get | videoId(string) | Video identifier | :heavy_check_mark: | - |
getStatus | videoId(string) | Video identifier | :heavy_check_mark: | - |
search | - | - | - | - |
- | parameters(object) | Search parameters | :x: |
|
create | - | - | - | - |
- | title(string) | Video title | :heavy_check_mark: | - |
- | properties(object) | Video properties | :x: |
|
upload | - | - | - | - |
- | source(string) | Video media file | :heavy_check_mark: | - |
- | properties(object) | Video properties | :x: |
|
- | videoId(string) | Video identifier | :x: | - |
uploadThumbnail | - | - | - | - |
- | source(string) | Image media file | :heavy_check_mark: | - |
- | videoId(string) | Video identifier | :heavy_check_mark: | - |
updateThumbnailWithTimeCode | - | - | - | - |
- | videoId(string) | Video identifier | :heavy_check_mark: | - |
- | timecode(string) | Video timecode | :heavy_check_mark: | 00:00:00.00 (hours:minutes:seconds.frames) |
update | - | - | - | - |
- | videoId()string | Video identifier | :heavy_check_mark: | - |
- | properties(object) | Video properties | :heavy_check_mark: |
|
makePublic | videoId(string) | Video identifier | :heavy_check_mark: | - |
makePrivate | videoId(string) | Video identifier | :heavy_check_mark: | - |
delete | videoId(string) | Video identifier | :heavy_check_mark: | - |
Function | Parameters | Description | Required | Allowed Values |
---|---|---|---|---|
get | playerId(string) | Player identifier | :heavy_check_mark: | - |
create | properties(object) | Player properties | :x: |
|
uploadLogo | - | - | - | - |
- | source(string) | Logo file | :heavy_check_mark: | - |
- | playerId(string) | Player identifier | :heavy_check_mark: | - |
- | link(string) | Logo link | :heavy_check_mark: | - |
search | - | - | - | - |
- | parameters(object) | Search parameters | :x: |
|
update | - | - | - | - |
- | playerId(string) | Player identifier | :heavy_check_mark: | - |
- | properties(object) | Player properties | :heavy_check_mark: |
|
deleteLogo | playerId(string) | Player identifier | :heavy_check_mark: | - |
delete | playerId(string) | Player identifier | :heavy_check_mark: | - |
Function | Parameters | Description | Required | Allowed Values |
---|---|---|---|---|
get | - | - | - | - |
- | videoId(string) | Video identifier | :heavy_check_mark: | - |
- | language(string) | Language identifier | :heavy_check_mark: | 2 letters (ex: en, fr) |
getAll | videoId(string) | Video identifier | :heavy_check_mark: | - |
upload | - | - | - | - |
- | source(string) | Caption file | :heavy_check_mark: | - |
- | properties(string) | Caption properties | :heavy_check_mark: |
|
updateDefault | - (object) | - | - | - |
- | videoId | Video identifier | :heavy_check_mark: | - |
- | language (string) | Language identifier | :heavy_check_mark: | 2 letters (ex: en, fr) |
- | isDefault (string) | Set default language | :heavy_check_mark: | true/false |
delete | - | - | - | - |
- | videoId | Video identifier | :heavy_check_mark: | - |
- | language (string) | Language identifier | :heavy_check_mark: | 2 letters (ex: en, fr) |
Function | Parameters | Description | Required | Allowed Values |
---|---|---|---|---|
get | - | - | - | - |
- | videoId(string) | Video identifier | :heavy_check_mark: | - |
- | language(string) | Language identifier | :heavy_check_mark: | 2 letters (ex: en, fr) |
getAll | videoId(string) | Video identifier | :heavy_check_mark: | - |
upload | - | - | - | - |
- | source(string) | Chapter file | :heavy_check_mark: | - |
- | properties(string) | Chapter properties | :heavy_check_mark: |
|
delete | - | - | - | - |
- | videoId | Video identifier | :heavy_check_mark: | - |
- | language (string) | Language identifier | :heavy_check_mark: | 2 letters (ex: en, fr) |
Function | Parameters | Description | Required | Allowed Values |
---|---|---|---|---|
get | liveStreamId(string) | Live identifier | :heavy_check_mark: | - |
search | - | - | - | - |
- | parameters(object) | Search parameters | :x: |
|
create | - | - | - | - |
- | name(string) | Live name | :heavy_check_mark: | - |
- | properties(object) | Live properties | :x: |
|
uploadThumbnail | - | - | - | - |
- | source(string) | Image media file | :heavy_check_mark: | - |
- | liveStreamId(string) | Live identifier | :heavy_check_mark: | - |
update | - | - | - | - |
- | liveStreamId()string | Live identifier | :heavy_check_mark: | - |
- | properties(object) | Live properties | :heavy_check_mark: |
|
delete | liveStreamId(string) | Live identifier | :heavy_check_mark: | - |
Function | Parameters | Description | Required | Allowed Values/Format |
---|---|---|---|---|
get | - | - | - | - |
- | videoId(string) | Video identifier | :heavy_check_mark: | - |
- | period (string) | Period research | :x: |
|
Function | Parameters | Description | Required | Allowed Values/Format |
---|---|---|---|---|
get | - | - | - | - |
- | liveStreamId(string) | Live identifier | :heavy_check_mark: | - |
- | period (string) | Period research | :x: |
|
Function | Parameters | Description | Required | Allowed Values/Format |
---|---|---|---|---|
get | - | - | - | - |
- | sessionId(string) | Session identifier | :heavy_check_mark: | - |
- | parameters(array) | Search parameters | :x: |
|
Function | Parameters | Description | Required | Allowed Values |
---|---|---|---|---|
generate | - | Token for delegated upload | - | - |
Function | Parameters | Description | Required | Allowed Values |
---|---|---|---|---|
- | - | - |
A full technical documentation is available on https://docs.api.video/
npm run test
You can also run a bunch of commands against your actual sandbox:
API_KEY=xxx npm run test:sandbox
Use the Sandbox API Key and not your production key.
FAQs
Nodejs SDK for api.video
We found that @api.video/nodejs-sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.