@vonage/video
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -1,8 +0,6 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ArchiveOutputMode = void 0; | ||
var ArchiveOutputMode; | ||
export var ArchiveOutputMode; | ||
(function (ArchiveOutputMode) { | ||
ArchiveOutputMode["COMPOSED"] = "composed"; | ||
ArchiveOutputMode["INDIVIDUAL"] = "individual"; | ||
})(ArchiveOutputMode = exports.ArchiveOutputMode || (exports.ArchiveOutputMode = {})); | ||
})(ArchiveOutputMode || (ArchiveOutputMode = {})); | ||
//# sourceMappingURL=ArchiveOutputMode.js.map |
@@ -1,5 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.LayoutType = void 0; | ||
var LayoutType; | ||
export var LayoutType; | ||
(function (LayoutType) { | ||
@@ -11,2 +8,3 @@ LayoutType["BEST_FIT"] = "bestFit"; | ||
LayoutType["VERTICAL_PRESENTATION"] = "verticalPresentation"; | ||
})(LayoutType = exports.LayoutType || (exports.LayoutType = {})); | ||
})(LayoutType || (LayoutType = {})); | ||
//# sourceMappingURL=LayoutType.js.map |
@@ -1,5 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Resolution = void 0; | ||
var Resolution; | ||
export var Resolution; | ||
(function (Resolution) { | ||
@@ -12,2 +9,3 @@ Resolution["FHD_LANDSCAPE"] = "1920x1080"; | ||
Resolution["SD_PORTRAIT"] = "480x640"; | ||
})(Resolution = exports.Resolution || (exports.Resolution = {})); | ||
})(Resolution || (Resolution = {})); | ||
//# sourceMappingURL=Resolution.js.map |
@@ -1,8 +0,6 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.StreamMode = void 0; | ||
var StreamMode; | ||
export var StreamMode; | ||
(function (StreamMode) { | ||
StreamMode["AUTO"] = "auto"; | ||
StreamMode["MANUAL"] = "manual"; | ||
})(StreamMode = exports.StreamMode || (exports.StreamMode = {})); | ||
})(StreamMode || (StreamMode = {})); | ||
//# sourceMappingURL=StreamMode.js.map |
@@ -1,5 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Video = void 0; | ||
var video_1 = require("./video"); | ||
Object.defineProperty(exports, "Video", { enumerable: true, get: function () { return video_1.Video; } }); | ||
export { Video } from './video'; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=ArchiveLayout.js.map |
@@ -1,8 +0,6 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ArchiveMode = void 0; | ||
var ArchiveMode; | ||
export var ArchiveMode; | ||
(function (ArchiveMode) { | ||
ArchiveMode["MANUAL"] = "manual"; | ||
ArchiveMode["ALWAYS"] = "always"; | ||
})(ArchiveMode = exports.ArchiveMode || (exports.ArchiveMode = {})); | ||
})(ArchiveMode || (ArchiveMode = {})); | ||
//# sourceMappingURL=ArchiveMode.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=ArchiveOptions.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=ArchiveSearchFilter.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=BroadcastConfig.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=BroadcastSearchFilter.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=BroadcastUpdateConfig.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=ClientTokenOptions.js.map |
@@ -1,8 +0,6 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.MediaMode = void 0; | ||
var MediaMode; | ||
export var MediaMode; | ||
(function (MediaMode) { | ||
MediaMode["ROUTED"] = "disabled"; | ||
MediaMode["RELAYED"] = "enabled"; | ||
})(MediaMode = exports.MediaMode || (exports.MediaMode = {})); | ||
})(MediaMode || (MediaMode = {})); | ||
//# sourceMappingURL=MediaMode.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=BroadcastDetailsResponse.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=CreateSessionResponse.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=MultiArchiveResponse.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=MultiBroadcastResponse.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=MultiStreamLayoutResponse.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=ProjectDetailsResponse.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=SingleArchiveResponse.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=SingleStreamLayoutResponse.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=RTMPStream.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=Session.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=StreamClassList.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=VideoResponse.js.map |
import { AuthOpts } from '@vonage/auth'; | ||
import { AuthInterface } from '@vonage/auth'; | ||
import { VetchOptions } from '@vonage/vetch'; | ||
export declare type VideoClassParameters = AuthOpts & VetchOptions & { | ||
export type VideoClassParameters = AuthOpts & VetchOptions & { | ||
applicationId: string; | ||
@@ -6,0 +6,0 @@ privateKey: string; |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=VideoClassParameters.js.map |
@@ -1,73 +0,46 @@ | ||
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Video = void 0; | ||
const jwt_1 = require("@vonage/jwt"); | ||
const MediaMode_1 = require("./interfaces/MediaMode"); | ||
const ArchiveMode_1 = require("./interfaces/ArchiveMode"); | ||
const server_client_1 = require("@vonage/server-client"); | ||
class Video extends server_client_1.Client { | ||
import { tokenGenerate } from '@vonage/jwt'; | ||
import { MediaMode } from './interfaces/MediaMode'; | ||
import { ArchiveMode } from './interfaces/ArchiveMode'; | ||
import { AuthenticationType, Client } from '@vonage/server-client'; | ||
export class Video extends Client { | ||
constructor() { | ||
super(...arguments); | ||
this.authType = server_client_1.AuthenticationType.JWT; | ||
this.authType = AuthenticationType.JWT; | ||
} | ||
addArchiveStream(archiveId, streamId, audio = true, video = true) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const data = { | ||
addStream: streamId, | ||
hasAudio: audio, | ||
hasVideo: video, | ||
}; | ||
yield this.sendPatchRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/archive/${archiveId}/stream`, data); | ||
}); | ||
async addArchiveStream(archiveId, streamId, audio = true, video = true) { | ||
const data = { | ||
addStream: streamId, | ||
hasAudio: audio, | ||
hasVideo: video, | ||
}; | ||
await this.sendPatchRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/archive/${archiveId}/stream`, data); | ||
} | ||
addStreamToBroadcast(broadcastId, streamId) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.updateBroadcast({ broadcastId, addStream: streamId }); | ||
}); | ||
async addStreamToBroadcast(broadcastId, streamId) { | ||
await this.updateBroadcast({ broadcastId, addStream: streamId }); | ||
} | ||
createSession(sessionOptions) { | ||
var _a, _b, _c; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const data = { | ||
archiveMode: (_a = sessionOptions === null || sessionOptions === void 0 ? void 0 : sessionOptions.archiveMode) !== null && _a !== void 0 ? _a : ArchiveMode_1.ArchiveMode.MANUAL, | ||
'p2p.preference': (_b = sessionOptions === null || sessionOptions === void 0 ? void 0 : sessionOptions.mediaMode) !== null && _b !== void 0 ? _b : MediaMode_1.MediaMode.ROUTED, | ||
location: (_c = sessionOptions === null || sessionOptions === void 0 ? void 0 : sessionOptions.location) !== null && _c !== void 0 ? _c : null, | ||
}; | ||
const resp = yield this.sendFormSubmitRequest(`${this.config.videoHost}/session/create`, data); | ||
return { | ||
sessionId: resp.data[0].session_id, | ||
archiveMode: data.archiveMode, | ||
mediaMode: data['p2p.preference'], | ||
location: data.location, | ||
}; | ||
}); | ||
async createSession(sessionOptions) { | ||
const data = { | ||
archiveMode: sessionOptions?.archiveMode ?? ArchiveMode.MANUAL, | ||
'p2p.preference': sessionOptions?.mediaMode ?? MediaMode.ROUTED, | ||
location: sessionOptions?.location ?? null, | ||
}; | ||
const resp = await this.sendFormSubmitRequest(`${this.config.videoHost}/session/create`, data); | ||
return { | ||
sessionId: resp.data[0].session_id, | ||
archiveMode: data.archiveMode, | ||
mediaMode: data['p2p.preference'], | ||
location: data.location, | ||
}; | ||
} | ||
deleteArchive(archiveId) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.sendDeleteRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/archive/${archiveId}`); | ||
}); | ||
async deleteArchive(archiveId) { | ||
await this.sendDeleteRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/archive/${archiveId}`); | ||
} | ||
disableForceMute(sessionId, excludedStreamIds = []) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return this.muteAllStreams(sessionId, false, excludedStreamIds); | ||
}); | ||
async disableForceMute(sessionId, excludedStreamIds = []) { | ||
return this.muteAllStreams(sessionId, false, excludedStreamIds); | ||
} | ||
disconnectClient(sessionId, connectionId) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.sendDeleteRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/session/${sessionId}/connection/${connectionId}`); | ||
}); | ||
async disconnectClient(sessionId, connectionId) { | ||
await this.sendDeleteRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/session/${sessionId}/connection/${connectionId}`); | ||
} | ||
forceMuteAll(sessionId, excludedStreamIds = []) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return this.muteAllStreams(sessionId, true, excludedStreamIds); | ||
}); | ||
async forceMuteAll(sessionId, excludedStreamIds = []) { | ||
return this.muteAllStreams(sessionId, true, excludedStreamIds); | ||
} | ||
@@ -82,133 +55,99 @@ generateClientToken(sessionId, tokenOptions) { | ||
}; | ||
if (tokenOptions === null || tokenOptions === void 0 ? void 0 : tokenOptions.role) { | ||
if (tokenOptions?.role) { | ||
claims.role = tokenOptions.role; | ||
} | ||
if (tokenOptions === null || tokenOptions === void 0 ? void 0 : tokenOptions.data) { | ||
if (tokenOptions?.data) { | ||
claims.connection_data = tokenOptions.data; | ||
} | ||
if (tokenOptions === null || tokenOptions === void 0 ? void 0 : tokenOptions.initialLayoutClassList) { | ||
if (tokenOptions?.initialLayoutClassList) { | ||
claims.initial_layout_class_list = tokenOptions.initialLayoutClassList.join(' '); | ||
} | ||
if ((tokenOptions === null || tokenOptions === void 0 ? void 0 : tokenOptions.expireTime) && tokenOptions.expireTime > now) { | ||
if (tokenOptions?.expireTime && tokenOptions.expireTime > now) { | ||
claims.exp = tokenOptions.expireTime; | ||
} | ||
return (0, jwt_1.tokenGenerate)(this.auth.applicationId, this.auth.privateKey, claims); | ||
return tokenGenerate(this.auth.applicationId, this.auth.privateKey, claims); | ||
} | ||
getArchive(archiveId) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const resp = yield this.sendGetRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/archive/${archiveId}`); | ||
return resp.data; | ||
}); | ||
async getArchive(archiveId) { | ||
const resp = await this.sendGetRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/archive/${archiveId}`); | ||
return resp.data; | ||
} | ||
getBroadcast(broadcastId) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const resp = yield this.sendGetRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/broadcast/${broadcastId}`); | ||
return resp.data; | ||
}); | ||
async getBroadcast(broadcastId) { | ||
const resp = await this.sendGetRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/broadcast/${broadcastId}`); | ||
return resp.data; | ||
} | ||
getStreamInfo(sessionId, streamId) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
let url = `${this.config.videoHost}/v2/project/${this.auth.applicationId}/session/${sessionId}/stream`; | ||
if (streamId) { | ||
url = url + `/${streamId}`; | ||
} | ||
let resp; | ||
if (streamId) { | ||
resp = yield this.sendGetRequest(url); | ||
} | ||
else { | ||
resp = yield this.sendGetRequest(url); | ||
} | ||
return resp.data; | ||
}); | ||
async getStreamInfo(sessionId, streamId) { | ||
let url = `${this.config.videoHost}/v2/project/${this.auth.applicationId}/session/${sessionId}/stream`; | ||
if (streamId) { | ||
url = url + `/${streamId}`; | ||
} | ||
let resp; | ||
if (streamId) { | ||
resp = await this.sendGetRequest(url); | ||
} | ||
else { | ||
resp = await this.sendGetRequest(url); | ||
} | ||
return resp.data; | ||
} | ||
muteAllStreams(sessionId, active, excludedStreamIds = []) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const resp = yield this.sendPostRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/session/${sessionId}/mute`, { | ||
active, | ||
excludedStreamIds, | ||
}); | ||
return resp.data; | ||
async muteAllStreams(sessionId, active, excludedStreamIds = []) { | ||
const resp = await this.sendPostRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/session/${sessionId}/mute`, { | ||
active, | ||
excludedStreamIds, | ||
}); | ||
return resp.data; | ||
} | ||
muteStream(sessionId, streamId) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const resp = yield this.sendPostRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/session/${sessionId}/stream/${streamId}/mute`); | ||
return resp.data; | ||
}); | ||
async muteStream(sessionId, streamId) { | ||
const resp = await this.sendPostRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/session/${sessionId}/stream/${streamId}/mute`); | ||
return resp.data; | ||
} | ||
removeArchiveStream(archiveId, streamId) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.sendPatchRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/archive/${archiveId}/stream`, { removeStream: streamId }); | ||
}); | ||
async removeArchiveStream(archiveId, streamId) { | ||
await this.sendPatchRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/archive/${archiveId}/stream`, { removeStream: streamId }); | ||
} | ||
removeStreamFromBroadcast(broadcastId, streamId) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.updateBroadcast({ broadcastId, removeStream: streamId }); | ||
}); | ||
async removeStreamFromBroadcast(broadcastId, streamId) { | ||
await this.updateBroadcast({ broadcastId, removeStream: streamId }); | ||
} | ||
searchArchives(filter) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const resp = yield this.sendGetRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/archive`, filter); | ||
return resp.data; | ||
}); | ||
async searchArchives(filter) { | ||
const resp = await this.sendGetRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/archive`, filter); | ||
return resp.data; | ||
} | ||
searchBroadcasts(filter) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const resp = yield this.sendGetRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/broadcast/`, filter); | ||
return resp.data; | ||
}); | ||
async searchBroadcasts(filter) { | ||
const resp = await this.sendGetRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/broadcast/`, filter); | ||
return resp.data; | ||
} | ||
sendSignal(signal, sessionId, connectionId) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
let url = `${this.config.videoHost}/v2/project/${this.auth.applicationId}/session/${sessionId}/signal`; | ||
if (connectionId) { | ||
url = `${this.config.videoHost}/v2/project/${this.auth.applicationId}/session/${sessionId}/connection/${connectionId}/signal`; | ||
} | ||
yield this.sendPostRequest(url, signal); | ||
}); | ||
async sendSignal(signal, sessionId, connectionId) { | ||
let url = `${this.config.videoHost}/v2/project/${this.auth.applicationId}/session/${sessionId}/signal`; | ||
if (connectionId) { | ||
url = `${this.config.videoHost}/v2/project/${this.auth.applicationId}/session/${sessionId}/connection/${connectionId}/signal`; | ||
} | ||
await this.sendPostRequest(url, signal); | ||
} | ||
setStreamClassLists(sessionId, settings) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.sendPutRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/session/${sessionId}/stream`, { items: settings }); | ||
}); | ||
async setStreamClassLists(sessionId, settings) { | ||
await this.sendPutRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/session/${sessionId}/stream`, { items: settings }); | ||
} | ||
startArchive(sessionId, options) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const data = Object.assign({}, { sessionId }, options); | ||
const resp = yield this.sendPostRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/archive`, data); | ||
return resp.data; | ||
}); | ||
async startArchive(sessionId, options) { | ||
const data = Object.assign({}, { sessionId }, options); | ||
const resp = await this.sendPostRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/archive`, data); | ||
return resp.data; | ||
} | ||
startBroadcast(sessionId, config) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const data = Object.assign({}, { sessionId }, config); | ||
const resp = yield this.sendPostRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/broadcast/`, data); | ||
return resp.data; | ||
}); | ||
async startBroadcast(sessionId, config) { | ||
const data = Object.assign({}, { sessionId }, config); | ||
const resp = await this.sendPostRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/broadcast/`, data); | ||
return resp.data; | ||
} | ||
stopArchive(archiveId) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const resp = yield this.sendPostRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/archive/${archiveId}/stop`); | ||
return resp.data; | ||
}); | ||
async stopArchive(archiveId) { | ||
const resp = await this.sendPostRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/archive/${archiveId}/stop`); | ||
return resp.data; | ||
} | ||
stopBroadcast(broadcastId) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const resp = yield this.sendPostRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/broadcast/${broadcastId}/stop`); | ||
return resp.data; | ||
}); | ||
async stopBroadcast(broadcastId) { | ||
const resp = await this.sendPostRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/broadcast/${broadcastId}/stop`); | ||
return resp.data; | ||
} | ||
updateArchiveLayout(archiveId, layout) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const resp = yield this.sendPutRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/archive/${archiveId}/layout`, layout); | ||
return resp.data; | ||
}); | ||
async updateArchiveLayout(archiveId, layout) { | ||
const resp = await this.sendPutRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/archive/${archiveId}/layout`, layout); | ||
return resp.data; | ||
} | ||
updateBroadcast(config) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.sendPatchRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/broadcast/${config.broadcastId}/streams`, config); | ||
}); | ||
async updateBroadcast(config) { | ||
await this.sendPatchRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/broadcast/${config.broadcastId}/streams`, config); | ||
} | ||
} | ||
exports.Video = Video; | ||
//# sourceMappingURL=video.js.map |
{ | ||
"name": "@vonage/video", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Package to interact with the Vonage Video API (Not OpenTok Compatible)", | ||
@@ -30,28 +30,19 @@ "keywords": [ | ||
"build": "npm run clean && npm run compile", | ||
"clean": "tsc -b --clean", | ||
"compile": "tsc -p tsconfig.json", | ||
"format": "prettier --write \"lib/**/*.ts\"", | ||
"lint": "tslint -p tsconfig.json", | ||
"prepublishOnly": "npm run build && npm run test && npm run lint", | ||
"test": "npx jest", | ||
"test-watch": "npx jest --watch", | ||
"preversion": "npm run lint", | ||
"version": "npm run format && git add -A lib" | ||
"clean": "npx shx rm -rf dist tsconfig.tsbuildinfo", | ||
"compile": "npx tsc --build --verbose" | ||
}, | ||
"dependencies": { | ||
"@vonage/server-client": "^1.0.6" | ||
"@vonage/auth": "^1.0.4", | ||
"@vonage/jwt": "^1.0.4", | ||
"@vonage/server-client": "^1.0.7", | ||
"@vonage/vetch": "^1.0.5" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^28.1.6", | ||
"jsonwebtoken": "^8.5.1", | ||
"nock": "^13.2.9", | ||
"prettier": "^2.7.1", | ||
"ts-jest": "^28.0.7", | ||
"tslint": "^6.1.3", | ||
"tslint-config-prettier": "^1.18.0", | ||
"typescript": "^4.7.4" | ||
"nock": "^13.2.9" | ||
}, | ||
"publishConfig": { | ||
"directory": "dist" | ||
} | ||
}, | ||
"gitHead": "328f18e5c8a458cb4d06d7955ec2399a6ce6f5d8" | ||
} |
# Vonage Video SDK for Node.js | ||
![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/vonage/vonage-node-sdk/Vonage/master?logo=github&style=flat-square&label=Workflow%20Build) [![Codecov](https://img.shields.io/codecov/c/github/vonage/vonage-node-sdk?label=Codecov&logo=codecov&style=flat-square)](https://codecov.io/gh/Vonage/vonage-server-sdk) ![Latest Release](https://img.shields.io/github/v/release/vonage/vonage-node-sdk?logo=npm&style=flat-square) | ||
![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/vonage/vonage-node-sdk/Vonage/3.x?logo=github&style=flat-square&label=Workflow%20Build) | ||
[![Codecov](https://img.shields.io/codecov/c/github/vonage/vonage-node-sdk?label=Codecov&logo=codecov&style=flat-square)](https://codecov.io/gh/Vonage/vonage-server-sdk) | ||
![Latest Release](https://img.shields.io/npm/v/@vonage/video) | ||
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg?style=flat-square)](../../CODE_OF_CONDUCT.md) | ||
[![License](https://img.shields.io/npm/l/@vonage/video?label=License&style=flat-square)][license] | ||
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg?style=flat-square)](../../CODE_OF_CONDUCT.md) [![License](https://img.shields.io/npm/l/@vonage/server-sdk?label=License&style=flat-square)][../../LICENSE.TXT] | ||
<img src="https://developer.nexmo.com/images/logos/vbc-logo.svg" height="48px" alt="Vonage" /> | ||
This is the Vonage Video SDK for Node.js for use with [Vonage APIs](https://www.vonage.com/). To use it you will need a Vonage account. Sign up [for free at vonage.com][signup]. | ||
This is the Vonage Video SDK for Node.js for use with | ||
[Vonage APIs](https://www.vonage.com/). To use it you will need a Vonage | ||
account. Sign up [for free at vonage.com][signup]. | ||
For full API documentation refer to [developer.nexmo.com](https://developer.nexmo.com/). | ||
For full API documentation refer to | ||
[developer.vonage.com](https://developer.vonage.com/). | ||
* [Installation](#installation) | ||
* [Constructor](#constructor) | ||
* [Callbacks](#callbacks) | ||
* [Usage](#using-the-vonage-video-sdk) | ||
* [Promise](#promises) | ||
* [Testing](#testing) | ||
* [Examples](#examples) | ||
* [Supported APIs](#supported-apis) | ||
@@ -36,5 +40,8 @@ | ||
### Standalone | ||
Unlike the other SDK's this package is not include in the | ||
[Vonage Server SDK for Node.js](https://github.com/vonage/vonage-node-sdk) | ||
The SDK can be used standalone from the main [Vonage Server SDK for Node.js](https://github.com/vonage/vonage-node-sdk) if you only need to use the Video APIs. All you need to do is `require('@vonage/video')`, and use the returned object to create your own client. | ||
You only need to use the Video APIs. All you need to do is | ||
`require('@vonage/video')`, and use the returned object to create your own | ||
client. | ||
@@ -45,21 +52,16 @@ ```js | ||
const videoClient = new Video(new Auth({ | ||
const credentials = new Auth({ | ||
applicationId: APP_ID, | ||
privateKey: PRIVATE_KEY_PATH, | ||
}), options); | ||
}); | ||
const options = {}; | ||
const videoClient = new Video(credentials, options); | ||
``` | ||
* `applicationId` - (optional) The Vonage API Application ID to be used when creating JWTs. | ||
* `privateKey` - (optional) The Private Key to be used when creating JWTs. You can specify the key as any of the following: | ||
* A [Buffer](https://nodejs.org/api/buffer.html#buffer_class_method_buffer_from_string_encoding) containing the file contents. | ||
* A String containing the path to the key file on disk. | ||
* A String containing the key itself. | ||
Where `credentials` is any option from [`@vonage/auth`](https://github.com/Vonage/vonage-node-sdk/tree/3.x/readme/packages/auth#options), | ||
and `options` is any option from [`@vonage/server-client`](https://github.com/Vonage/vonage-node-sdk/tree/3.x/readme/packages/server-client#options) | ||
`options` is an object that can contain: | ||
* `videoHost` - (optional) A base URL to use instead of the default `https://video.api.vonage.com` | ||
## Promises | ||
This SDK uses Promises to return data. | ||
This SDK uses Promises to return data. | ||
@@ -78,6 +80,2 @@ ```js | ||
## Examples | ||
Forthcoming. | ||
## Supported APIs | ||
@@ -87,4 +85,4 @@ | ||
| API | Supported? | ||
|----------|:-------------:| | ||
| API | Supported? | | ||
|----------|-------------| | ||
| Session Creation | ✅ | | ||
@@ -100,4 +98,3 @@ | Signaling | ✅ | | ||
[signup]: https://dashboard.nexmo.com/sign-up?utm_source=DEV_REL&utm_medium=github&utm_campaign=node-server-sdk | ||
[license]: ../../LICENSE.txt |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34468
2
86
4
463
96
+ Added@vonage/auth@^1.0.4
+ Added@vonage/jwt@^1.0.4
+ Added@vonage/vetch@^1.0.5
Updated@vonage/server-client@^1.0.7