@vonage/video
Advanced tools
Comparing version 1.13.0 to 1.14.0
@@ -0,4 +1,13 @@ | ||
/** | ||
* Enum representing different output modes for video archives. | ||
*/ | ||
export declare enum ArchiveOutputMode { | ||
/** | ||
* Represents the composed output mode where all streams are mixed into one. | ||
*/ | ||
COMPOSED = "composed", | ||
/** | ||
* Represents the individual output mode where each stream is recorded separately. | ||
*/ | ||
INDIVIDUAL = "individual" | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ArchiveOutputMode = void 0; | ||
/** | ||
* Enum representing different output modes for video archives. | ||
*/ | ||
var ArchiveOutputMode; | ||
(function (ArchiveOutputMode) { | ||
/** | ||
* Represents the composed output mode where all streams are mixed into one. | ||
*/ | ||
ArchiveOutputMode["COMPOSED"] = "composed"; | ||
/** | ||
* Represents the individual output mode where each stream is recorded separately. | ||
*/ | ||
ArchiveOutputMode["INDIVIDUAL"] = "individual"; | ||
})(ArchiveOutputMode || (exports.ArchiveOutputMode = ArchiveOutputMode = {})); | ||
//# sourceMappingURL=ArchiveOutputMode.js.map |
@@ -0,4 +1,13 @@ | ||
/** | ||
* Enum representing different audio sample rates. | ||
*/ | ||
export declare enum AudioRate { | ||
/** | ||
* Represents an audio sample rate of 16 kHz. | ||
*/ | ||
"16KHZ" = 16000, | ||
/** | ||
* Represents an audio sample rate of 8 kHz. | ||
*/ | ||
"8KHZ" = 8000 | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AudioRate = void 0; | ||
/** | ||
* Enum representing different audio sample rates. | ||
*/ | ||
var AudioRate; | ||
(function (AudioRate) { | ||
/** | ||
* Represents an audio sample rate of 16 kHz. | ||
*/ | ||
AudioRate[AudioRate["16KHZ"] = 16000] = "16KHZ"; | ||
/** | ||
* Represents an audio sample rate of 8 kHz. | ||
*/ | ||
AudioRate[AudioRate["8KHZ"] = 8000] = "8KHZ"; | ||
})(AudioRate || (exports.AudioRate = AudioRate = {})); | ||
//# sourceMappingURL=AudioRate.js.map |
@@ -0,6 +1,21 @@ | ||
/** | ||
* Enum representing different captioning status. | ||
*/ | ||
export declare enum CaptionStatus { | ||
/** | ||
* Indicates that captioning has started. | ||
*/ | ||
STARTED = "started", | ||
/** | ||
* Indicates that captioning has stopped. | ||
*/ | ||
STOPPED = "stopped", | ||
/** | ||
* Indicates that captioning has been paused. | ||
*/ | ||
PAUSED = "paused", | ||
/** | ||
* Indicates that captioning has failed. | ||
*/ | ||
FAILED = "failed" | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CaptionStatus = void 0; | ||
/** | ||
* Enum representing different captioning status. | ||
*/ | ||
var CaptionStatus; | ||
(function (CaptionStatus) { | ||
/** | ||
* Indicates that captioning has started. | ||
*/ | ||
CaptionStatus["STARTED"] = "started"; | ||
/** | ||
* Indicates that captioning has stopped. | ||
*/ | ||
CaptionStatus["STOPPED"] = "stopped"; | ||
/** | ||
* Indicates that captioning has been paused. | ||
*/ | ||
CaptionStatus["PAUSED"] = "paused"; | ||
/** | ||
* Indicates that captioning has failed. | ||
*/ | ||
CaptionStatus["FAILED"] = "failed"; | ||
})(CaptionStatus || (exports.CaptionStatus = CaptionStatus = {})); | ||
//# sourceMappingURL=CaptionStatus.js.map |
@@ -0,6 +1,21 @@ | ||
/** | ||
* Enum representing different resolutions for an experience composer. | ||
*/ | ||
export declare enum ExperienceComposerResolution { | ||
/** | ||
* Standard definition landscape resolution. | ||
*/ | ||
SD_LANDSCAPE = "640x480", | ||
/** | ||
* Standard definition portrait resolution. | ||
*/ | ||
SD_PORTRAIT = "480x640", | ||
/** | ||
* High definition landscape resolution. | ||
*/ | ||
HD_LANDSCAPE = "1280x720", | ||
/** | ||
* High definition portrait resolution. | ||
*/ | ||
HD_PORTRAIT = "720x1280" | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ExperienceComposerResolution = void 0; | ||
/** | ||
* Enum representing different resolutions for an experience composer. | ||
*/ | ||
var ExperienceComposerResolution; | ||
(function (ExperienceComposerResolution) { | ||
/** | ||
* Standard definition landscape resolution. | ||
*/ | ||
ExperienceComposerResolution["SD_LANDSCAPE"] = "640x480"; | ||
/** | ||
* Standard definition portrait resolution. | ||
*/ | ||
ExperienceComposerResolution["SD_PORTRAIT"] = "480x640"; | ||
/** | ||
* High definition landscape resolution. | ||
*/ | ||
ExperienceComposerResolution["HD_LANDSCAPE"] = "1280x720"; | ||
/** | ||
* High definition portrait resolution. | ||
*/ | ||
ExperienceComposerResolution["HD_PORTRAIT"] = "720x1280"; | ||
})(ExperienceComposerResolution || (exports.ExperienceComposerResolution = ExperienceComposerResolution = {})); | ||
//# sourceMappingURL=ExperienceComposerResolution.js.map |
@@ -8,1 +8,2 @@ export * from './ArchiveOutputMode'; | ||
export * from './StreamMode'; | ||
export * from './MediaMode'; |
@@ -24,2 +24,2 @@ "use strict"; | ||
__exportStar(require("./StreamMode"), exports); | ||
//# sourceMappingURL=index.js.map | ||
__exportStar(require("./MediaMode"), exports); |
@@ -0,7 +1,25 @@ | ||
/** | ||
* Enum representing different layout types for live streaming broadcasts. | ||
*/ | ||
export declare enum LayoutType { | ||
/** | ||
* Automatically determine the best fit layout. | ||
*/ | ||
BEST_FIT = "bestFit", | ||
/** | ||
* Use a custom layout for the broadcast. | ||
*/ | ||
CUSTOM = "custom", | ||
/** | ||
* Horizontal presentation layout. | ||
*/ | ||
HORIZONTAL_PRESENTATION = "horizontalPresentation", | ||
/** | ||
* Picture-in-picture (PIP) layout. | ||
*/ | ||
PIP = "pip", | ||
/** | ||
* Vertical presentation layout. | ||
*/ | ||
VERTICAL_PRESENTATION = "verticalPresentation" | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.LayoutType = void 0; | ||
/** | ||
* Enum representing different layout types for live streaming broadcasts. | ||
*/ | ||
var LayoutType; | ||
(function (LayoutType) { | ||
/** | ||
* Automatically determine the best fit layout. | ||
*/ | ||
LayoutType["BEST_FIT"] = "bestFit"; | ||
/** | ||
* Use a custom layout for the broadcast. | ||
*/ | ||
LayoutType["CUSTOM"] = "custom"; | ||
/** | ||
* Horizontal presentation layout. | ||
*/ | ||
LayoutType["HORIZONTAL_PRESENTATION"] = "horizontalPresentation"; | ||
/** | ||
* Picture-in-picture (PIP) layout. | ||
*/ | ||
LayoutType["PIP"] = "pip"; | ||
/** | ||
* Vertical presentation layout. | ||
*/ | ||
LayoutType["VERTICAL_PRESENTATION"] = "verticalPresentation"; | ||
})(LayoutType || (exports.LayoutType = LayoutType = {})); | ||
//# sourceMappingURL=LayoutType.js.map |
@@ -0,8 +1,29 @@ | ||
/** | ||
* Enum representing different video resolutions for live streaming broadcasts. | ||
*/ | ||
export declare enum Resolution { | ||
/** | ||
* Full HD landscape resolution (1920x1080 pixels). | ||
*/ | ||
FHD_LANDSCAPE = "1920x1080", | ||
/** | ||
* Full HD portrait resolution (1080x1920 pixels). | ||
*/ | ||
FHD_PORTRAIT = "1080x1920", | ||
/** | ||
* HD landscape resolution (1280x720 pixels). | ||
*/ | ||
HD_LANDSCAPE = "1280x720", | ||
/** | ||
* HD portrait resolution (720x1280 pixels). | ||
*/ | ||
HD_PORTRAIT = "720x1280", | ||
/** | ||
* Standard definition landscape resolution (640x480 pixels). | ||
*/ | ||
SD_LANDSCAPE = "640x480", | ||
/** | ||
* Standard definition portrait resolution (480x640 pixels). | ||
*/ | ||
SD_PORTRAIT = "480x640" | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Resolution = void 0; | ||
/** | ||
* Enum representing different video resolutions for live streaming broadcasts. | ||
*/ | ||
var Resolution; | ||
(function (Resolution) { | ||
/** | ||
* Full HD landscape resolution (1920x1080 pixels). | ||
*/ | ||
Resolution["FHD_LANDSCAPE"] = "1920x1080"; | ||
/** | ||
* Full HD portrait resolution (1080x1920 pixels). | ||
*/ | ||
Resolution["FHD_PORTRAIT"] = "1080x1920"; | ||
/** | ||
* HD landscape resolution (1280x720 pixels). | ||
*/ | ||
Resolution["HD_LANDSCAPE"] = "1280x720"; | ||
/** | ||
* HD portrait resolution (720x1280 pixels). | ||
*/ | ||
Resolution["HD_PORTRAIT"] = "720x1280"; | ||
/** | ||
* Standard definition landscape resolution (640x480 pixels). | ||
*/ | ||
Resolution["SD_LANDSCAPE"] = "640x480"; | ||
/** | ||
* Standard definition portrait resolution (480x640 pixels). | ||
*/ | ||
Resolution["SD_PORTRAIT"] = "480x640"; | ||
})(Resolution || (exports.Resolution = Resolution = {})); | ||
//# sourceMappingURL=Resolution.js.map |
@@ -0,4 +1,13 @@ | ||
/** | ||
* Enum representing different stream modes for live streaming broadcasts. | ||
*/ | ||
export declare enum StreamMode { | ||
/** | ||
* Streams are selected automatically based on session rules. | ||
*/ | ||
AUTO = "auto", | ||
/** | ||
* Streams are manually selected for inclusion in the broadcast. | ||
*/ | ||
MANUAL = "manual" | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.StreamMode = void 0; | ||
/** | ||
* Enum representing different stream modes for live streaming broadcasts. | ||
*/ | ||
var StreamMode; | ||
(function (StreamMode) { | ||
/** | ||
* Streams are selected automatically based on session rules. | ||
*/ | ||
StreamMode["AUTO"] = "auto"; | ||
/** | ||
* Streams are manually selected for inclusion in the broadcast. | ||
*/ | ||
StreamMode["MANUAL"] = "manual"; | ||
})(StreamMode || (exports.StreamMode = StreamMode = {})); | ||
//# sourceMappingURL=StreamMode.js.map |
export * from './enums'; | ||
export * from './interfaces'; | ||
export * from './types'; | ||
export * from './parameters'; | ||
export * from './video'; |
@@ -18,5 +18,4 @@ "use strict"; | ||
__exportStar(require("./enums"), exports); | ||
__exportStar(require("./interfaces"), exports); | ||
__exportStar(require("./types"), exports); | ||
__exportStar(require("./parameters"), exports); | ||
__exportStar(require("./video"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -18,2 +18,1 @@ "use strict"; | ||
__exportStar(require("./VideoClassParameters"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -1,8 +0,20 @@ | ||
import { AuthOpts } from '@vonage/auth'; | ||
import { AuthParams } from '@vonage/auth'; | ||
import { AuthInterface } from '@vonage/auth'; | ||
import { VetchOptions } from '@vonage/vetch'; | ||
export type VideoClassParameters = AuthOpts & VetchOptions & { | ||
/** | ||
* Parameters required to initialize the Video class. | ||
*/ | ||
export type VideoClassParameters = AuthParams & VetchOptions & { | ||
/** | ||
* The unique identifier for the application. | ||
*/ | ||
applicationId: string; | ||
/** | ||
* The private key used for authentication. | ||
*/ | ||
privateKey: string; | ||
/** | ||
* Optional authentication interface to use for custom authentication. | ||
*/ | ||
auth?: AuthInterface; | ||
}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=VideoClassParameters.js.map |
@@ -1,36 +0,151 @@ | ||
import { MultiStreamLayoutResponse } from './interfaces/Response/MultiStreamLayoutResponse'; | ||
import { SingleStreamLayoutResponse } from './interfaces/Response/SingleStreamLayoutResponse'; | ||
import { ProjectDetailsResponse } from './interfaces/Response/ProjectDetailsResponse'; | ||
import { ArchiveOptions } from './interfaces/ArchiveOptions'; | ||
import { SingleArchiveResponse } from './interfaces/Response/SingleArchiveResponse'; | ||
import { MultiArchiveResponse } from './interfaces/Response/MultiArchiveResponse'; | ||
import { ArchiveSearchFilter } from './interfaces/ArchiveSearchFilter'; | ||
import { ArchiveLayout } from './interfaces/ArchiveLayout'; | ||
import { MediaMode } from './interfaces/MediaMode'; | ||
import { ArchiveMode } from './interfaces/ArchiveMode'; | ||
import { Session } from './interfaces/Session'; | ||
import { StreamClassList } from './interfaces/StreamClassList'; | ||
import { ClientTokenOptions } from './interfaces/ClientTokenOptions'; | ||
import { AuthenticationType, Client } from '@vonage/server-client'; | ||
import { BroadcastConfig } from './interfaces/BroadcastConfig'; | ||
import { BroadcastDetailsResponse } from './interfaces/Response/BroadcastDetailsResponse'; | ||
import { BroadcastSearchFilter } from './interfaces/BroadcastSearchFilter'; | ||
import { MultiBroadcastResponse } from './interfaces/Response/MultiBroadcastResponse'; | ||
import { BroadcastUpdateConfig } from './interfaces/BroadcastUpdateConfig'; | ||
import { SIPCallOptions } from './interfaces/SIPCallOptions'; | ||
import { SIPCallResponse } from './interfaces/Response/SIPCallResponse'; | ||
import { WebSocketConfig } from './interfaces/WebSocketConfig'; | ||
import { WebSocketConnectResponse } from './interfaces/Response/WebSocketConnectResponse'; | ||
import { MultiExperienceComposerResponse } from './interfaces/Response/MultiExperienceComposerResponse'; | ||
import { ExperienceComposerResponse } from './interfaces/Response/ExperienceComposerResponse'; | ||
import { ExperienceComposerOptions } from './interfaces/ExperienceComposerOptions'; | ||
import { ExperienceComposerListFilter } from './interfaces/ExperienceComposerListFilter'; | ||
import { CaptionOptions } from './interfaces/CaptionOptions'; | ||
import { EnableCaptionResponse } from './interfaces/Response/EnableCaptionResponse'; | ||
import { CaptionStatusResponse } from './interfaces/Response/CaptionStatusResponse'; | ||
import { MediaMode } from './enums'; | ||
import { ArchiveLayout, ArchiveMode, ArchiveOptions, ArchiveSearchFilter, BroadcastConfig, BroadcastDetailsResponse, BroadcastSearchFilter, BroadcastUpdateConfig, CaptionOptions, CaptionStatusResponse, ClientTokenOptions, EnableCaptionResponse, ExperienceComposerListFilter, ExperienceComposerOptions, ExperienceComposerResponse, MultiArchiveResponse, MultiBroadcastResponse, MultiExperienceComposerResponse, MultiStreamLayoutResponse, ProjectDetailsResponse, SIPCallOptions, SIPCallResponse, Session, Signal, SingleArchiveResponse, SingleStreamLayoutResponse, StreamClassList, WebSocketConfig, WebSocketConnectResponse } from './types'; | ||
/** | ||
* Video Client for managing and interacting with video-related operations in your application. | ||
* This client allows you to control sessions, streams, archives, broadcasts, and various video-related features. | ||
* | ||
* Usage: | ||
* - Create and manage video sessions with customizable settings. | ||
* - Control video streams, including muting, adding, and removing streams. | ||
* - Initiate SIP calls and establish WebSockets for real-time communication. | ||
* - Enable and disable captions for improved accessibility. | ||
* - Start, stop, and manage video archives and broadcasts. | ||
* - Render experiences and access detailed information about streams and archives. | ||
* - Generate client tokens for secure session connections. | ||
* - Perform various video-related operations with ease. | ||
* | ||
* @remarks | ||
* The Video Client is designed to simplify video management tasks within your application. | ||
* It provides a comprehensive set of methods and options to configure and control video interactions seamlessly. | ||
* | ||
* @example | ||
* Create a standalone Video client | ||
* | ||
* ```ts | ||
* import { Video } from '@vonage/video'; | ||
* | ||
* const videoClient = new Video({ | ||
* apiKey: VONAGE_API_KEY, | ||
* apiSecret: VONAGE_API_SECRET | ||
* }); | ||
* ``` | ||
* | ||
* @example | ||
* Create an Video client from the Vonage client | ||
* | ||
* ```ts | ||
* import { Vonage } from '@vonage/server-client'; | ||
* | ||
* const vonage = new Vonage({ | ||
* apiKey: VONAGE_API_KEY, | ||
* apiSecret: VONAGE_API_SECRET | ||
* }); | ||
* | ||
* const videoClient = vonage.video; | ||
* ``` | ||
*/ | ||
export declare class Video extends Client { | ||
protected authType: AuthenticationType; | ||
/** | ||
* Adds a stream to an existing archive, allowing you to include additional streams in the archive recording. | ||
* | ||
* @param {string} archiveId - The ID of the archive to which you want to add a stream. | ||
* @param {string} streamId - The ID of the stream you want to add to the archive. | ||
* @param {boolean} [audio=true] - Whether to include audio from the added stream (default: true). | ||
* @param {boolean} [video=true] - Whether to include video from the added stream (default: true). | ||
* @return {Promise<void>} A promise that resolves when the stream has been successfully added to the archive. | ||
* @throws {Error} If an error occurs while adding the stream to the archive. | ||
* | ||
* @example | ||
* ```ts | ||
* await videoClient.addArchiveStream(ARCHIVE_ID, STREAM_ID); | ||
* ``` | ||
*/ | ||
addArchiveStream(archiveId: string, streamId: string, audio?: boolean, video?: boolean): Promise<void>; | ||
/** | ||
* Adds a stream to an existing broadcast, allowing you to include additional streams in the live broadcast. | ||
* | ||
* @param {string} broadcastId - The ID of the broadcast to which you want to add a stream. | ||
* @param {string} streamId - The ID of the stream you want to add to the broadcast. | ||
* @return {Promise<void>} A promise that resolves when the stream has been successfully added to the broadcast. | ||
* @throws {Error} If an error occurs while adding the stream to the broadcast. | ||
* | ||
* @example | ||
* ```ts | ||
* await videoClient.addStreamToBroadcast(BROADCAST_ID, STREAM_ID); | ||
* ``` | ||
*/ | ||
addStreamToBroadcast(broadcastId: string, streamId: string): Promise<void>; | ||
/** | ||
* Connects to a WebSocket for a specified session using the provided client token and WebSocket configuration. | ||
* | ||
* @param {string} sessionId - The ID of the session to which you want to connect via WebSocket. | ||
* @param {string} clientToken - The client token generated for authentication. | ||
* @param {WebSocketConfig} config - The WebSocket configuration specifying the URI and optional parameters. | ||
* @return {Promise<WebSocketConnectResponse>} A promise that resolves with WebSocket connection details upon successful connection. | ||
* @throws {Error} If an error occurs during the WebSocket connection process. | ||
* | ||
* @example | ||
* ```ts | ||
* const result = await videoClient.connectToWebsocket( | ||
* SESSION_ID, | ||
* CLIENT_TOKEN, | ||
* { | ||
* uri: 'wss://example.com', | ||
* }, | ||
* ) | ||
* | ||
* console.log(result.id); | ||
* ``` | ||
*/ | ||
connectToWebsocket(sessionId: string, clientToken: string, config: WebSocketConfig): Promise<WebSocketConnectResponse>; | ||
/** | ||
* Creates a new session with the specified options. | ||
* | ||
* @param {Object} [sessionOptions] - Optional session configuration options. | ||
* @param {ArchiveMode} [sessionOptions.archiveMode=ArchiveMode.MANUAL] - The archive mode for the session. | ||
* @param {MediaMode} [sessionOptions.mediaMode=MediaMode.ROUTED] - The media mode for the session. | ||
* @param {string} [sessionOptions.location] - The location for the session. | ||
* @return {Promise<Session>} A promise that resolves with details of the newly created session. | ||
* @throws {Error} If an error occurs during the session creation process. | ||
* | ||
* @example | ||
* Create a session with default options | ||
* ```ts | ||
* const session = await videoClient.createSession({}); | ||
* console.log(session.sessionId); | ||
* ``` | ||
* | ||
* @example | ||
* Create a session with archive mode set to manual | ||
* ```ts | ||
* import { ArchiveMode } from '@vonage/video'; | ||
* | ||
* const session = await videoClient.createSession({ | ||
* archiveMode: ArchiveMode.MANUAL, | ||
* }); | ||
* console.log(session.sessionId); | ||
* ``` | ||
* | ||
* @example | ||
* Create a session with location set to a specific region | ||
* ```ts | ||
* const session = await videoClient.createSession({ | ||
* location: 'eu', | ||
* }); | ||
* console.log(session.sessionId); | ||
* ``` | ||
* | ||
* @example | ||
* Create a session with media mode set to routed | ||
* ```ts | ||
* import { MediaMode } from '@vonage/video'; | ||
* | ||
* const session = await videoClient.createSession({ | ||
* mediaMode: MediaMode.ROUTED, | ||
* }); | ||
* console.log(session.sessionId); | ||
* ``` | ||
*/ | ||
createSession(sessionOptions?: { | ||
@@ -41,38 +156,519 @@ archiveMode?: ArchiveMode; | ||
}): Promise<Session>; | ||
/** | ||
* Deletes an archive with the specified archive ID. | ||
* | ||
* @param {string} archiveId - The ID of the archive to delete. | ||
* @return {Promise<void>} A promise that resolves when the archive is successfully deleted. | ||
* @throws {Error} If an error occurs while deleting the archive or if the archive with the given ID does not exist. | ||
* | ||
* @example | ||
* ```ts | ||
* await videoClient.deleteArchive(ARCHIVE_ID); | ||
* ``` | ||
*/ | ||
deleteArchive(archiveId: string): Promise<void>; | ||
/** | ||
* Disables captions for a specific caption ID. | ||
* | ||
* @param {string} captionId - The ID of the caption to disable. | ||
* @return {Promise<void>} A promise that resolves when the captions are successfully disabled. | ||
* @throws {Error} If an error occurs while disabling captions or if the caption with the given ID does not exist. | ||
* | ||
* @example | ||
* ```ts | ||
* await videoClient.disableCaptions(CAPTION_ID); | ||
* ``` | ||
*/ | ||
disableCaptions(captionId: string): Promise<void>; | ||
/** | ||
* Disables force mute for a session, allowing audio for all streams. | ||
* | ||
* @param {string} sessionId - The ID of the session for which to disable force mute. | ||
* @param {string[]} excludedStreamIds - An optional array of stream IDs to exclude from the force mute operation. | ||
* @return {Promise<void>} A promise that resolves when the force mute is successfully disabled for the session. | ||
* @throws {Error} If an error occurs while disabling force mute or if the session with the given ID does not exist. | ||
* | ||
* @example | ||
* ```ts | ||
* const forceMute = await videoClient.disableForceMute(SESSION_ID); | ||
* console.log(forceMute.status); | ||
* ``` | ||
*/ | ||
disableForceMute(sessionId: string, excludedStreamIds?: string[]): Promise<ProjectDetailsResponse>; | ||
/** | ||
* Disconnects a client from a session. | ||
* | ||
* @param {string} sessionId - The ID of the session from which to disconnect the client. | ||
* @param {string} connectionId - The ID of the client's connection to disconnect. | ||
* @return {Promise<void>} A promise that resolves when the client is successfully disconnected from the session. | ||
* @throws {Error} If an error occurs while disconnecting the client or if the session or connection with the given IDs do not exist. | ||
* | ||
* @example | ||
* ```ts | ||
* await videoClient.disconnectClient(SESSION_ID, CONNECTION_ID); | ||
* ``` | ||
*/ | ||
disconnectClient(sessionId: string, connectionId: string): Promise<void>; | ||
/** | ||
* Disconnects a WebSocket connection associated with a call or session. | ||
* | ||
* @param {string} callId - The ID of the call or session to which the WebSocket connection is associated. | ||
* @return {Promise<void>} A promise that resolves when the WebSocket connection is successfully disconnected. | ||
* @throws {Error} If an error occurs while disconnecting the WebSocket connection or if the call or session with the given ID does not exist. | ||
* | ||
* @example | ||
* ```ts | ||
* await videoClient.disconnectWebsocket(CALL_ID); | ||
* ``` | ||
*/ | ||
disconnectWebsocket(callId: string): Promise<void>; | ||
/** | ||
* Enables captions for a session using the specified client token and caption options. | ||
* | ||
* @param {string} sessionId - The ID of the session to enable captions for. | ||
* @param {string} clientToken - The client token associated with the session, used for authentication. | ||
* @param {CaptionOptions} [captionOptions] - Optional caption options to configure caption behavior. | ||
* @return {Promise<EnableCaptionResponse>} A promise that resolves with an `EnableCaptionResponse` containing information about the enabled captions. | ||
* @throws {Error} If an error occurs while enabling captions or if the session with the given ID does not exist. | ||
* | ||
* @example | ||
* ```ts | ||
* const result = await videoClient.enableCaptions(SESSION_ID, CLIENT_TOKEN); | ||
* console.log(result.captionId); | ||
* ``` | ||
*/ | ||
enableCaptions(sessionId: string, clientToken: string, captionOptions?: CaptionOptions): Promise<EnableCaptionResponse>; | ||
/** | ||
* Forces muting of all streams in a session, except those specified in the `excludedStreamIds` array. | ||
* | ||
* @param {string} sessionId - The ID of the session in which to force mute streams. | ||
* @param {string[]} [excludedStreamIds] - An optional array of stream IDs to exclude from muting. | ||
* @return {Promise<ProjectDetailsResponse>} A promise that resolves with a `ProjectDetailsResponse` containing updated session details after muting. | ||
* @throws {Error} If an error occurs while muting the streams or if the session with the given ID does not exist. | ||
* | ||
* @example | ||
* ```ts | ||
* const forceMute = await videoClient.forceMuteAll(SESSION_ID); | ||
* console.log(forceMute.status); | ||
* ``` | ||
*/ | ||
forceMuteAll(sessionId: string, excludedStreamIds?: string[]): Promise<ProjectDetailsResponse>; | ||
/** | ||
* Generates a client token for connecting to a session with the specified options. | ||
* | ||
* @param {string} sessionId - The ID of the session to generate the client token for. | ||
* @param {ClientTokenOptions} [tokenOptions] - Optional token options including role, data, and expiration time. | ||
* @return {string} A client token that can be used for authentication when connecting to a session. | ||
* | ||
* @example | ||
* ```ts | ||
* const token = videoClient.generateClientToken(SESSION_ID); | ||
* console.log(`The token is ${token}`); | ||
* ``` | ||
*/ | ||
generateClientToken(sessionId: string, tokenOptions?: ClientTokenOptions): string; | ||
/** | ||
* Retrieves information about a specific archive by its ID. | ||
* | ||
* @param {string} archiveId - The ID of the archive to retrieve. | ||
* @return {Promise<SingleArchiveResponse>} A promise that resolves to the details of the requested archive. | ||
* | ||
* @example | ||
* ```ts | ||
* const archive = await videoClient.getArchive(ARCHIVE_ID); | ||
* console.log(archive.createdAt); | ||
* ``` | ||
*/ | ||
getArchive(archiveId: string): Promise<SingleArchiveResponse>; | ||
/** | ||
* Retrieves information about a specific broadcast by its ID. | ||
* | ||
* @param {string} broadcastId - The ID of the broadcast to retrieve. | ||
* @return {Promise<BroadcastDetailsResponse>} A promise that resolves to the details of the requested broadcast. | ||
* | ||
* ```ts | ||
* const broadcast = await videoClient.getBroadcast(BROADCAST_ID); | ||
* console.log(broadcast.createdAt); | ||
* ``` | ||
*/ | ||
getBroadcast(broadcastId: string): Promise<BroadcastDetailsResponse>; | ||
/** | ||
* Retrieves the status of a caption by its ID. | ||
* | ||
* @param {string} captionId - The ID of the caption to retrieve the status for. | ||
* @return {Promise<CaptionStatusResponse>} A promise that resolves to the status of the requested caption. | ||
* | ||
* @example | ||
* ```ts | ||
* const captionStatus = await videoClient.getCaptionStatus(CAPTION_ID); | ||
* console.log(captionStatus.status); | ||
* ``` | ||
*/ | ||
getCaptionStatus(captionId: string): Promise<CaptionStatusResponse>; | ||
/** | ||
* Retrieves the details of an Experience Composer render by its ID. | ||
* | ||
* @param {string} renderId - The ID of the Experience Composer render to retrieve. | ||
* @return {Promise<ExperienceComposerResponse>} A promise that resolves to the details of the requested Experience Composer render. | ||
* | ||
* @example | ||
* ```ts | ||
* const render = await videoClient.getExperienceComposerRender(RENDER_ID); | ||
* console.log(render.createdAt); | ||
* ``` | ||
*/ | ||
getExperienceComposerRender(renderId: string): Promise<ExperienceComposerResponse>; | ||
/** | ||
* Retrieves information about one or more streams in a session. | ||
* | ||
* @param {string} sessionId - The ID of the session to retrieve stream information from. | ||
* @param {string | undefined} [streamId] - Optional. The ID of a specific stream to retrieve information for. | ||
* @return {Promise<MultiStreamLayoutResponse | SingleStreamLayoutResponse>} A promise that resolves to stream information. If a specific `streamId` is provided, it resolves to a single stream's information (SingleStreamLayoutResponse), otherwise, it resolves to multiple streams' information (MultiStreamLayoutResponse). | ||
* | ||
* @example | ||
* ```ts | ||
* const streamInfo = await videoClient.getStreamInfo(SESSION_ID); | ||
* | ||
* if (streamInfo.items) { | ||
* streamInfo.items.forEach((item) => { | ||
* console.log(item.id); | ||
* }); | ||
* } else { | ||
* console.log(streamInfo.id); | ||
* } | ||
* ``` | ||
*/ | ||
getStreamInfo(sessionId: string, streamId?: string): Promise<MultiStreamLayoutResponse | SingleStreamLayoutResponse>; | ||
private stripBlankValues; | ||
/** | ||
* Initiates a SIP call within a session. | ||
* | ||
* @param {string} sessionId - The ID of the session in which to initiate the SIP call. | ||
* @param {SIPCallOptions} options - The options for initiating the SIP call. | ||
* @return {Promise<SIPCallResponse>} A promise that resolves to the SIP call response, including the call ID and other details. | ||
* | ||
* @example | ||
* Start a SIP call with default options | ||
* ```ts | ||
* const sipCall = await videoClient.intiateSIPCall(SESSION_ID); | ||
* console.log(sipCall.id); | ||
* ``` | ||
* | ||
* @example | ||
* Start a SIP call with custom options | ||
* ```ts | ||
* const sipCall = await videoClient.intiateSIPCall( | ||
* SESSION_ID, | ||
* { | ||
* uri: 'sip://example.com', | ||
* } | ||
* ); | ||
* console.log(sipCall.id); | ||
* ``` | ||
*/ | ||
intiateSIPCall(sessionId: string, options: SIPCallOptions): Promise<SIPCallResponse>; | ||
/** | ||
* Lists Experience Composer renders based on the specified filter criteria. | ||
* | ||
* @param {ExperienceComposerListFilter} filter - An optional filter to apply when listing Experience Composer renders. | ||
* @return {Promise<MultiExperienceComposerResponse>} A promise that resolves to a list of Experience Composer renders matching the filter criteria. | ||
* | ||
* @example | ||
* ```ts | ||
* const renders = await videoClient.listExperienceComposerRenders(); | ||
* for (const render of renders.items) { | ||
* console.log(render.id); | ||
* } | ||
* ``` | ||
*/ | ||
listExperienceComposerRenders(filter: ExperienceComposerListFilter): Promise<MultiExperienceComposerResponse>; | ||
/** | ||
* Mutes or unmutes all streams in a session, optionally excluding specific stream IDs from muting. | ||
* | ||
* @param {string} sessionId - The ID of the session in which to mute or unmute streams. | ||
* @param {boolean} active - `true` to mute all streams, `false` to unmute all streams. | ||
* @param {string[]} excludedStreamIds - An optional array of stream IDs to exclude from muting/unmuting. | ||
* @return {Promise<ProjectDetailsResponse>} A promise that resolves to the updated session details. | ||
* | ||
* @example | ||
* ```ts | ||
* const forceMute = await videoClient.muteAll(SESSION_ID); | ||
* console.log(forceMute.status); | ||
* ``` | ||
*/ | ||
protected muteAllStreams(sessionId: string, active: boolean, excludedStreamIds?: string[]): Promise<ProjectDetailsResponse>; | ||
/** | ||
* Mutes or unmutes a specific stream in a session. | ||
* | ||
* @param {string} sessionId - The ID of the session containing the stream. | ||
* @param {string} streamId - The ID of the stream to mute or unmute. | ||
* @return {Promise<ProjectDetailsResponse>} A promise that resolves to the updated session details. | ||
* | ||
* @example | ||
* ```ts | ||
* const forceMute = await videoClient.muteStream(SESSION_ID, STREAM_ID); | ||
* console.log(forceMute.status); | ||
* ``` | ||
*/ | ||
muteStream(sessionId: string, streamId: string): Promise<ProjectDetailsResponse>; | ||
/** | ||
* Sends DTMF (Dual-Tone Multi-Frequency) tones to a specific session or connection. | ||
* | ||
* @param {string} sessionId - The ID of the session to send DTMF tones to. | ||
* @param {string} digits - The DTMF tones to play. | ||
* @param {string} [connectionId] - Optional. The ID of the connection within the session to send DTMF tones to. | ||
* @return {Promise<void>} A promise that resolves when the DTMF tones have been played. | ||
* | ||
* @example | ||
* ```ts | ||
* await videoClient.playDTMF(SESSION_ID, '1234'); | ||
* ``` | ||
*/ | ||
playDTMF(sessionId: string, digits: string, connectionId?: string): Promise<void>; | ||
/** | ||
* Removes a stream from an archive. | ||
* | ||
* @param {string} archiveId - The ID of the archive from which to remove the stream. | ||
* @param {string} streamId - The ID of the stream to remove from the archive. | ||
* @return {Promise<void>} A promise that resolves when the stream has been successfully removed from the archive. | ||
* | ||
* @example | ||
* ```ts | ||
* await videoClient.removeArchiveStream(ARCHIVE_ID, STREAM_ID); | ||
* ``` | ||
*/ | ||
removeArchiveStream(archiveId: string, streamId: string): Promise<void>; | ||
/** | ||
* Removes a stream from a broadcast. | ||
* | ||
* @param {string} broadcastId - The ID of the broadcast from which to remove the stream. | ||
* @param {string} streamId - The ID of the stream to remove from the broadcast. | ||
* @return {Promise<void>} A promise that resolves when the stream has been successfully removed from the broadcast. | ||
* | ||
* @example | ||
* ```ts | ||
* await videoClient.removeStreamFromBroadcast(BROADCAST_ID, STREAM_ID); | ||
* ``` | ||
*/ | ||
removeStreamFromBroadcast(broadcastId: string, streamId: string): Promise<void>; | ||
/** | ||
* Searches for archives based on the specified filter criteria. | ||
* | ||
* @param {ArchiveSearchFilter} [filter] - Optional filter criteria to narrow down the search. | ||
* @return {Promise<MultiArchiveResponse>} A promise that resolves with the search results, including multiple archive items. | ||
* | ||
* @example | ||
* ```ts | ||
* const archives = await videoClient.searchArchives(); | ||
* for (const archive of archives.items) { | ||
* console.log(archive.id); | ||
* } | ||
* ``` | ||
* @example | ||
* Search for archives for a session | ||
* ```ts | ||
* const archives = await videoClient.searchArchives({ | ||
* sessionId: SESSION_ID, | ||
* }); | ||
* | ||
* for (const archive of archives.items) { | ||
* console.log(archive.id); | ||
* } | ||
* ``` | ||
*/ | ||
searchArchives(filter?: ArchiveSearchFilter): Promise<MultiArchiveResponse>; | ||
/** | ||
* Searches for broadcasts based on the specified filter criteria. | ||
* | ||
* @param {BroadcastSearchFilter} [filter] - Optional filter criteria to narrow down the search. | ||
* @return {Promise<MultiBroadcastResponse>} A promise that resolves with the search results, including multiple broadcast items. | ||
* | ||
* @example | ||
* ```ts | ||
* const broadcasts = await videoClient.searchBroadcasts(); | ||
* for (const broadcast of broadcasts.items) { | ||
* console.log(broadcast.id); | ||
* } | ||
* ``` | ||
* | ||
* @example | ||
* Get braodcasts for a session | ||
* ```ts | ||
* const broadcasts = await videoClient.searchBroadcasts({ | ||
* sessionId: SESSION_ID, | ||
* }) | ||
* for (const broadcast of broadcasts.items) { | ||
* console.log(broadcast.id); | ||
* } | ||
* ``` | ||
*/ | ||
searchBroadcasts(filter?: BroadcastSearchFilter): Promise<MultiBroadcastResponse>; | ||
sendSignal(signal: { | ||
type: string; | ||
data: string; | ||
}, sessionId: string, connectionId?: string): Promise<void>; | ||
/** | ||
* Sends a signal to a session or a specific connection within a session. | ||
* | ||
* @param {Signal} signal - The signal to send, including a type and data. | ||
* @param {string} sessionId - The ID of the session to which the signal will be sent. | ||
* @param {string} [connectionId] - Optional. The ID of the connection within the session to which the signal will be sent. If not provided, the signal will be sent to the entire session. | ||
* @return {Promise<void>} A promise that resolves when the signal is successfully sent. | ||
* | ||
* @example | ||
* await videoClient.sendSignal( | ||
* { | ||
* type: 'text', | ||
* data: 'Hello world!', | ||
* }, | ||
* SESSION_ID, | ||
* ); | ||
* ``` | ||
*/ | ||
sendSignal(signal: Signal, sessionId: string, connectionId?: string): Promise<void>; | ||
/** | ||
* Sets the stream class lists for one or more streams within a session. | ||
* | ||
* @param {string} sessionId - The ID of the session for which stream class lists will be set. | ||
* @param {StreamClassList[]} settings - An array of objects specifying the stream ID and corresponding class lists to be set. | ||
* @return {Promise<void>} A promise that resolves when the stream class lists are successfully set. | ||
* | ||
* @example | ||
* | ||
* ```ts | ||
* await videoClient.setStreamClassLists( | ||
* SESSION_ID, | ||
* [ | ||
* { | ||
* id: STREAM_ID, | ||
* layoutClassList: ['full'], | ||
* } | ||
* ] | ||
* ) | ||
* ``` | ||
*/ | ||
setStreamClassLists(sessionId: string, settings: StreamClassList[]): Promise<void>; | ||
/** | ||
* Starts an archive for a given session with optional configuration. | ||
* | ||
* @param {string} sessionId - The ID of the session to archive. | ||
* @param {ArchiveOptions} [options] - Optional configuration for the archive, such as audio/video settings, layout, and more. | ||
* @return {Promise<SingleArchiveResponse>} A promise that resolves with information about the started archive. | ||
* | ||
* @example | ||
* ```ts | ||
* const archive = await videoClient.startArchive(SESSION_ID); | ||
* console.log(archive.id); | ||
* ``` | ||
*/ | ||
startArchive(sessionId: string, options?: ArchiveOptions): Promise<SingleArchiveResponse>; | ||
/** | ||
* Starts a broadcast for a given session with the specified configuration. | ||
* | ||
* @param {string} sessionId - The ID of the session to start broadcasting. | ||
* @param {BroadcastConfig} config - Configuration for the broadcast, including stream settings, layout, and more. | ||
* @return {Promise<BroadcastDetailsResponse>} A promise that resolves with information about the started broadcast. | ||
* | ||
* @example | ||
* ```ts | ||
* const broadcast = await videoClient.startBroadcast( | ||
* SESSION_ID, | ||
* { | ||
* outputs: { | ||
* hls: { | ||
* lowLatency: true, | ||
* } | ||
* rtmp: [{ | ||
* serverUrl: 'rtmp://example.com', | ||
* }], | ||
* } | ||
* } | ||
* ); | ||
* ``` | ||
*/ | ||
startBroadcast(sessionId: string, config: BroadcastConfig): Promise<BroadcastDetailsResponse>; | ||
/** | ||
* Starts rendering an experience composer with the provided configuration. | ||
* | ||
* @param {string} sessionId - The ID of the session associated with the experience composer. | ||
* @param {string} token - The client token for authentication. | ||
* @param {ExperienceComposerOptions} config - Configuration options for the experience composer rendering. | ||
* @return {Promise<ExperienceComposerResponse>} A promise that resolves with information about the started experience composer rendering. | ||
* | ||
* @example | ||
* ```ts | ||
* | ||
* const render = await videoClient.startExperienceComposerRender( | ||
* SESSION_ID, | ||
* token, | ||
* ) | ||
* | ||
* console.log(render.id); | ||
* ``` | ||
*/ | ||
startExperienceComposerRender(sessionId: string, token: string, config: ExperienceComposerOptions): Promise<ExperienceComposerResponse>; | ||
/** | ||
* Stops an archive with the given archive ID. | ||
* | ||
* @param {string} archiveId - The ID of the archive to stop. | ||
* @return {Promise<SingleArchiveResponse>} A promise that resolves with information about the stopped archive. | ||
* | ||
* @example | ||
* ```ts | ||
* const archive = await videoClient.stopArchive(ARCHIVE_ID); | ||
* | ||
* console.log(archive.status); | ||
* ``` | ||
*/ | ||
stopArchive(archiveId: string): Promise<SingleArchiveResponse>; | ||
/** | ||
* Stops a broadcast with the given broadcast ID. | ||
* | ||
* @param {string} broadcastId - The ID of the broadcast to stop. | ||
* @return {Promise<BroadcastDetailsResponse>} A promise that resolves with information about the stopped broadcast. | ||
* | ||
* @example | ||
* ```ts | ||
* const broadcast = await videoClient.stopBroadcast(BROADCAST_ID); | ||
* console.log(broadcast.status); | ||
* ``` | ||
*/ | ||
stopBroadcast(broadcastId: string): Promise<BroadcastDetailsResponse>; | ||
/** | ||
* Stops an Experience Composer render with the given render ID. | ||
* | ||
* @param {string} renderId - The ID of the Experience Composer render to stop. | ||
* @return {Promise<void>} A promise that resolves when the render is successfully stopped. | ||
* | ||
* @example | ||
* ```ts | ||
* await videoClient.stopExperienceComposerRender(RENDER_ID); | ||
* ``` | ||
*/ | ||
stopExperienceComposerRender(renderId: string): Promise<void>; | ||
/** | ||
* Updates the layout of an archive with the given archive ID. | ||
* | ||
* @param {string} archiveId - The ID of the archive to update the layout for. | ||
* @param {ArchiveLayout} layout - The new layout configuration to set for the archive. | ||
* @return {Promise<void>} A promise that resolves when the layout is successfully updated. | ||
* | ||
* @example | ||
* ```ts | ||
* await videoClient.updateArchiveLayout( | ||
* ``` | ||
*/ | ||
updateArchiveLayout(archiveId: string, layout: ArchiveLayout): Promise<void>; | ||
/** | ||
* Updates the configuration of a broadcast with the given broadcast ID. | ||
* | ||
* @param {BroadcastUpdateConfig} config - The configuration options to update the broadcast. | ||
* @return {Promise<void>} A promise that resolves when the broadcast is successfully updated. | ||
* | ||
* @example | ||
* ```ts | ||
* | ||
* await videoClient.updateBroadcast({ | ||
* broadcastId: BROADCAST_ID, | ||
* hasAudio: true, | ||
* }) | ||
* ``` | ||
*/ | ||
updateBroadcast(config: BroadcastUpdateConfig): Promise<void>; | ||
} |
@@ -5,7 +5,69 @@ "use strict"; | ||
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"); | ||
const enums_1 = require("./enums"); | ||
const types_1 = require("./types"); | ||
/** | ||
* Video Client for managing and interacting with video-related operations in your application. | ||
* This client allows you to control sessions, streams, archives, broadcasts, and various video-related features. | ||
* | ||
* Usage: | ||
* - Create and manage video sessions with customizable settings. | ||
* - Control video streams, including muting, adding, and removing streams. | ||
* - Initiate SIP calls and establish WebSockets for real-time communication. | ||
* - Enable and disable captions for improved accessibility. | ||
* - Start, stop, and manage video archives and broadcasts. | ||
* - Render experiences and access detailed information about streams and archives. | ||
* - Generate client tokens for secure session connections. | ||
* - Perform various video-related operations with ease. | ||
* | ||
* @remarks | ||
* The Video Client is designed to simplify video management tasks within your application. | ||
* It provides a comprehensive set of methods and options to configure and control video interactions seamlessly. | ||
* | ||
* @example | ||
* Create a standalone Video client | ||
* | ||
* ```ts | ||
* import { Video } from '@vonage/video'; | ||
* | ||
* const videoClient = new Video({ | ||
* apiKey: VONAGE_API_KEY, | ||
* apiSecret: VONAGE_API_SECRET | ||
* }); | ||
* ``` | ||
* | ||
* @example | ||
* Create an Video client from the Vonage client | ||
* | ||
* ```ts | ||
* import { Vonage } from '@vonage/server-client'; | ||
* | ||
* const vonage = new Vonage({ | ||
* apiKey: VONAGE_API_KEY, | ||
* apiSecret: VONAGE_API_SECRET | ||
* }); | ||
* | ||
* const videoClient = vonage.video; | ||
* ``` | ||
*/ | ||
class Video extends server_client_1.Client { | ||
authType = server_client_1.AuthenticationType.JWT; | ||
constructor() { | ||
super(...arguments); | ||
this.authType = server_client_1.AuthenticationType.JWT; | ||
} | ||
/** | ||
* Adds a stream to an existing archive, allowing you to include additional streams in the archive recording. | ||
* | ||
* @param {string} archiveId - The ID of the archive to which you want to add a stream. | ||
* @param {string} streamId - The ID of the stream you want to add to the archive. | ||
* @param {boolean} [audio=true] - Whether to include audio from the added stream (default: true). | ||
* @param {boolean} [video=true] - Whether to include video from the added stream (default: true). | ||
* @return {Promise<void>} A promise that resolves when the stream has been successfully added to the archive. | ||
* @throws {Error} If an error occurs while adding the stream to the archive. | ||
* | ||
* @example | ||
* ```ts | ||
* await videoClient.addArchiveStream(ARCHIVE_ID, STREAM_ID); | ||
* ``` | ||
*/ | ||
async addArchiveStream(archiveId, streamId, audio = true, video = true) { | ||
@@ -19,5 +81,40 @@ const data = { | ||
} | ||
/** | ||
* Adds a stream to an existing broadcast, allowing you to include additional streams in the live broadcast. | ||
* | ||
* @param {string} broadcastId - The ID of the broadcast to which you want to add a stream. | ||
* @param {string} streamId - The ID of the stream you want to add to the broadcast. | ||
* @return {Promise<void>} A promise that resolves when the stream has been successfully added to the broadcast. | ||
* @throws {Error} If an error occurs while adding the stream to the broadcast. | ||
* | ||
* @example | ||
* ```ts | ||
* await videoClient.addStreamToBroadcast(BROADCAST_ID, STREAM_ID); | ||
* ``` | ||
*/ | ||
async addStreamToBroadcast(broadcastId, streamId) { | ||
await this.updateBroadcast({ broadcastId, addStream: streamId }); | ||
} | ||
/** | ||
* Connects to a WebSocket for a specified session using the provided client token and WebSocket configuration. | ||
* | ||
* @param {string} sessionId - The ID of the session to which you want to connect via WebSocket. | ||
* @param {string} clientToken - The client token generated for authentication. | ||
* @param {WebSocketConfig} config - The WebSocket configuration specifying the URI and optional parameters. | ||
* @return {Promise<WebSocketConnectResponse>} A promise that resolves with WebSocket connection details upon successful connection. | ||
* @throws {Error} If an error occurs during the WebSocket connection process. | ||
* | ||
* @example | ||
* ```ts | ||
* const result = await videoClient.connectToWebsocket( | ||
* SESSION_ID, | ||
* CLIENT_TOKEN, | ||
* { | ||
* uri: 'wss://example.com', | ||
* }, | ||
* ) | ||
* | ||
* console.log(result.id); | ||
* ``` | ||
*/ | ||
async connectToWebsocket(sessionId, clientToken, config) { | ||
@@ -32,6 +129,54 @@ const data = { | ||
} | ||
/** | ||
* Creates a new session with the specified options. | ||
* | ||
* @param {Object} [sessionOptions] - Optional session configuration options. | ||
* @param {ArchiveMode} [sessionOptions.archiveMode=ArchiveMode.MANUAL] - The archive mode for the session. | ||
* @param {MediaMode} [sessionOptions.mediaMode=MediaMode.ROUTED] - The media mode for the session. | ||
* @param {string} [sessionOptions.location] - The location for the session. | ||
* @return {Promise<Session>} A promise that resolves with details of the newly created session. | ||
* @throws {Error} If an error occurs during the session creation process. | ||
* | ||
* @example | ||
* Create a session with default options | ||
* ```ts | ||
* const session = await videoClient.createSession({}); | ||
* console.log(session.sessionId); | ||
* ``` | ||
* | ||
* @example | ||
* Create a session with archive mode set to manual | ||
* ```ts | ||
* import { ArchiveMode } from '@vonage/video'; | ||
* | ||
* const session = await videoClient.createSession({ | ||
* archiveMode: ArchiveMode.MANUAL, | ||
* }); | ||
* console.log(session.sessionId); | ||
* ``` | ||
* | ||
* @example | ||
* Create a session with location set to a specific region | ||
* ```ts | ||
* const session = await videoClient.createSession({ | ||
* location: 'eu', | ||
* }); | ||
* console.log(session.sessionId); | ||
* ``` | ||
* | ||
* @example | ||
* Create a session with media mode set to routed | ||
* ```ts | ||
* import { MediaMode } from '@vonage/video'; | ||
* | ||
* const session = await videoClient.createSession({ | ||
* mediaMode: MediaMode.ROUTED, | ||
* }); | ||
* console.log(session.sessionId); | ||
* ``` | ||
*/ | ||
async createSession(sessionOptions) { | ||
const data = { | ||
archiveMode: sessionOptions?.archiveMode ?? ArchiveMode_1.ArchiveMode.MANUAL, | ||
'p2p.preference': sessionOptions?.mediaMode ?? MediaMode_1.MediaMode.ROUTED, | ||
archiveMode: sessionOptions?.archiveMode ?? types_1.ArchiveMode.MANUAL, | ||
'p2p.preference': sessionOptions?.mediaMode ?? enums_1.MediaMode.ROUTED, | ||
location: sessionOptions?.location ?? null, | ||
@@ -41,3 +186,3 @@ }; | ||
return { | ||
sessionId: resp.data[0].session_id, | ||
sessionId: resp.data.session_id, | ||
archiveMode: data.archiveMode, | ||
@@ -48,17 +193,95 @@ mediaMode: data['p2p.preference'], | ||
} | ||
/** | ||
* Deletes an archive with the specified archive ID. | ||
* | ||
* @param {string} archiveId - The ID of the archive to delete. | ||
* @return {Promise<void>} A promise that resolves when the archive is successfully deleted. | ||
* @throws {Error} If an error occurs while deleting the archive or if the archive with the given ID does not exist. | ||
* | ||
* @example | ||
* ```ts | ||
* await videoClient.deleteArchive(ARCHIVE_ID); | ||
* ``` | ||
*/ | ||
async deleteArchive(archiveId) { | ||
await this.sendDeleteRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/archive/${archiveId}`); | ||
} | ||
/** | ||
* Disables captions for a specific caption ID. | ||
* | ||
* @param {string} captionId - The ID of the caption to disable. | ||
* @return {Promise<void>} A promise that resolves when the captions are successfully disabled. | ||
* @throws {Error} If an error occurs while disabling captions or if the caption with the given ID does not exist. | ||
* | ||
* @example | ||
* ```ts | ||
* await videoClient.disableCaptions(CAPTION_ID); | ||
* ``` | ||
*/ | ||
async disableCaptions(captionId) { | ||
await this.sendPostRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/captions/${captionId}/stop`); | ||
} | ||
/** | ||
* Disables force mute for a session, allowing audio for all streams. | ||
* | ||
* @param {string} sessionId - The ID of the session for which to disable force mute. | ||
* @param {string[]} excludedStreamIds - An optional array of stream IDs to exclude from the force mute operation. | ||
* @return {Promise<void>} A promise that resolves when the force mute is successfully disabled for the session. | ||
* @throws {Error} If an error occurs while disabling force mute or if the session with the given ID does not exist. | ||
* | ||
* @example | ||
* ```ts | ||
* const forceMute = await videoClient.disableForceMute(SESSION_ID); | ||
* console.log(forceMute.status); | ||
* ``` | ||
*/ | ||
async disableForceMute(sessionId, excludedStreamIds = []) { | ||
return this.muteAllStreams(sessionId, false, excludedStreamIds); | ||
} | ||
/** | ||
* Disconnects a client from a session. | ||
* | ||
* @param {string} sessionId - The ID of the session from which to disconnect the client. | ||
* @param {string} connectionId - The ID of the client's connection to disconnect. | ||
* @return {Promise<void>} A promise that resolves when the client is successfully disconnected from the session. | ||
* @throws {Error} If an error occurs while disconnecting the client or if the session or connection with the given IDs do not exist. | ||
* | ||
* @example | ||
* ```ts | ||
* await videoClient.disconnectClient(SESSION_ID, CONNECTION_ID); | ||
* ``` | ||
*/ | ||
async disconnectClient(sessionId, connectionId) { | ||
await this.sendDeleteRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/session/${sessionId}/connection/${connectionId}`); | ||
} | ||
/** | ||
* Disconnects a WebSocket connection associated with a call or session. | ||
* | ||
* @param {string} callId - The ID of the call or session to which the WebSocket connection is associated. | ||
* @return {Promise<void>} A promise that resolves when the WebSocket connection is successfully disconnected. | ||
* @throws {Error} If an error occurs while disconnecting the WebSocket connection or if the call or session with the given ID does not exist. | ||
* | ||
* @example | ||
* ```ts | ||
* await videoClient.disconnectWebsocket(CALL_ID); | ||
* ``` | ||
*/ | ||
async disconnectWebsocket(callId) { | ||
await this.sendPostRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/connect/${callId}/stop`); | ||
} | ||
/** | ||
* Enables captions for a session using the specified client token and caption options. | ||
* | ||
* @param {string} sessionId - The ID of the session to enable captions for. | ||
* @param {string} clientToken - The client token associated with the session, used for authentication. | ||
* @param {CaptionOptions} [captionOptions] - Optional caption options to configure caption behavior. | ||
* @return {Promise<EnableCaptionResponse>} A promise that resolves with an `EnableCaptionResponse` containing information about the enabled captions. | ||
* @throws {Error} If an error occurs while enabling captions or if the session with the given ID does not exist. | ||
* | ||
* @example | ||
* ```ts | ||
* const result = await videoClient.enableCaptions(SESSION_ID, CLIENT_TOKEN); | ||
* console.log(result.captionId); | ||
* ``` | ||
*/ | ||
async enableCaptions(sessionId, clientToken, captionOptions = {}) { | ||
@@ -69,5 +292,32 @@ const data = Object.assign({}, { sessionId, token: clientToken }, captionOptions); | ||
} | ||
/** | ||
* Forces muting of all streams in a session, except those specified in the `excludedStreamIds` array. | ||
* | ||
* @param {string} sessionId - The ID of the session in which to force mute streams. | ||
* @param {string[]} [excludedStreamIds] - An optional array of stream IDs to exclude from muting. | ||
* @return {Promise<ProjectDetailsResponse>} A promise that resolves with a `ProjectDetailsResponse` containing updated session details after muting. | ||
* @throws {Error} If an error occurs while muting the streams or if the session with the given ID does not exist. | ||
* | ||
* @example | ||
* ```ts | ||
* const forceMute = await videoClient.forceMuteAll(SESSION_ID); | ||
* console.log(forceMute.status); | ||
* ``` | ||
*/ | ||
async forceMuteAll(sessionId, excludedStreamIds = []) { | ||
return this.muteAllStreams(sessionId, true, excludedStreamIds); | ||
} | ||
/** | ||
* Generates a client token for connecting to a session with the specified options. | ||
* | ||
* @param {string} sessionId - The ID of the session to generate the client token for. | ||
* @param {ClientTokenOptions} [tokenOptions] - Optional token options including role, data, and expiration time. | ||
* @return {string} A client token that can be used for authentication when connecting to a session. | ||
* | ||
* @example | ||
* ```ts | ||
* const token = videoClient.generateClientToken(SESSION_ID); | ||
* console.log(`The token is ${token}`); | ||
* ``` | ||
*/ | ||
generateClientToken(sessionId, tokenOptions) { | ||
@@ -80,2 +330,3 @@ const now = Math.round(new Date().getTime() / 1000); | ||
initial_layout_class_list: '', | ||
exp: tokenOptions?.expireTime || now + 86400, | ||
sub: 'video', | ||
@@ -98,7 +349,16 @@ acl: { | ||
} | ||
if (tokenOptions?.expireTime && tokenOptions.expireTime > now) { | ||
claims.exp = tokenOptions.expireTime; | ||
} | ||
return (0, jwt_1.tokenGenerate)(this.auth.applicationId, this.auth.privateKey, claims); | ||
} | ||
/** | ||
* Retrieves information about a specific archive by its ID. | ||
* | ||
* @param {string} archiveId - The ID of the archive to retrieve. | ||
* @return {Promise<SingleArchiveResponse>} A promise that resolves to the details of the requested archive. | ||
* | ||
* @example | ||
* ```ts | ||
* const archive = await videoClient.getArchive(ARCHIVE_ID); | ||
* console.log(archive.createdAt); | ||
* ``` | ||
*/ | ||
async getArchive(archiveId) { | ||
@@ -108,2 +368,13 @@ const resp = await this.sendGetRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/archive/${archiveId}`); | ||
} | ||
/** | ||
* Retrieves information about a specific broadcast by its ID. | ||
* | ||
* @param {string} broadcastId - The ID of the broadcast to retrieve. | ||
* @return {Promise<BroadcastDetailsResponse>} A promise that resolves to the details of the requested broadcast. | ||
* | ||
* ```ts | ||
* const broadcast = await videoClient.getBroadcast(BROADCAST_ID); | ||
* console.log(broadcast.createdAt); | ||
* ``` | ||
*/ | ||
async getBroadcast(broadcastId) { | ||
@@ -113,2 +384,14 @@ const resp = await this.sendGetRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/broadcast/${broadcastId}`); | ||
} | ||
/** | ||
* Retrieves the status of a caption by its ID. | ||
* | ||
* @param {string} captionId - The ID of the caption to retrieve the status for. | ||
* @return {Promise<CaptionStatusResponse>} A promise that resolves to the status of the requested caption. | ||
* | ||
* @example | ||
* ```ts | ||
* const captionStatus = await videoClient.getCaptionStatus(CAPTION_ID); | ||
* console.log(captionStatus.status); | ||
* ``` | ||
*/ | ||
async getCaptionStatus(captionId) { | ||
@@ -118,2 +401,14 @@ const resp = await this.sendGetRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/captions/${captionId}`); | ||
} | ||
/** | ||
* Retrieves the details of an Experience Composer render by its ID. | ||
* | ||
* @param {string} renderId - The ID of the Experience Composer render to retrieve. | ||
* @return {Promise<ExperienceComposerResponse>} A promise that resolves to the details of the requested Experience Composer render. | ||
* | ||
* @example | ||
* ```ts | ||
* const render = await videoClient.getExperienceComposerRender(RENDER_ID); | ||
* console.log(render.createdAt); | ||
* ``` | ||
*/ | ||
async getExperienceComposerRender(renderId) { | ||
@@ -123,2 +418,22 @@ const resp = await this.sendGetRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/render/${renderId}`); | ||
} | ||
/** | ||
* Retrieves information about one or more streams in a session. | ||
* | ||
* @param {string} sessionId - The ID of the session to retrieve stream information from. | ||
* @param {string | undefined} [streamId] - Optional. The ID of a specific stream to retrieve information for. | ||
* @return {Promise<MultiStreamLayoutResponse | SingleStreamLayoutResponse>} A promise that resolves to stream information. If a specific `streamId` is provided, it resolves to a single stream's information (SingleStreamLayoutResponse), otherwise, it resolves to multiple streams' information (MultiStreamLayoutResponse). | ||
* | ||
* @example | ||
* ```ts | ||
* const streamInfo = await videoClient.getStreamInfo(SESSION_ID); | ||
* | ||
* if (streamInfo.items) { | ||
* streamInfo.items.forEach((item) => { | ||
* console.log(item.id); | ||
* }); | ||
* } else { | ||
* console.log(streamInfo.id); | ||
* } | ||
* ``` | ||
*/ | ||
async getStreamInfo(sessionId, streamId) { | ||
@@ -149,2 +464,28 @@ let url = `${this.config.videoHost}/v2/project/${this.auth.applicationId}/session/${sessionId}/stream`; | ||
} | ||
/** | ||
* Initiates a SIP call within a session. | ||
* | ||
* @param {string} sessionId - The ID of the session in which to initiate the SIP call. | ||
* @param {SIPCallOptions} options - The options for initiating the SIP call. | ||
* @return {Promise<SIPCallResponse>} A promise that resolves to the SIP call response, including the call ID and other details. | ||
* | ||
* @example | ||
* Start a SIP call with default options | ||
* ```ts | ||
* const sipCall = await videoClient.intiateSIPCall(SESSION_ID); | ||
* console.log(sipCall.id); | ||
* ``` | ||
* | ||
* @example | ||
* Start a SIP call with custom options | ||
* ```ts | ||
* const sipCall = await videoClient.intiateSIPCall( | ||
* SESSION_ID, | ||
* { | ||
* uri: 'sip://example.com', | ||
* } | ||
* ); | ||
* console.log(sipCall.id); | ||
* ``` | ||
*/ | ||
async intiateSIPCall(sessionId, options) { | ||
@@ -159,2 +500,16 @@ let data = Object.assign({}, { sessionId }, options); | ||
} | ||
/** | ||
* Lists Experience Composer renders based on the specified filter criteria. | ||
* | ||
* @param {ExperienceComposerListFilter} filter - An optional filter to apply when listing Experience Composer renders. | ||
* @return {Promise<MultiExperienceComposerResponse>} A promise that resolves to a list of Experience Composer renders matching the filter criteria. | ||
* | ||
* @example | ||
* ```ts | ||
* const renders = await videoClient.listExperienceComposerRenders(); | ||
* for (const render of renders.items) { | ||
* console.log(render.id); | ||
* } | ||
* ``` | ||
*/ | ||
async listExperienceComposerRenders(filter) { | ||
@@ -164,2 +519,16 @@ const resp = await this.sendGetRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/render`, filter); | ||
} | ||
/** | ||
* Mutes or unmutes all streams in a session, optionally excluding specific stream IDs from muting. | ||
* | ||
* @param {string} sessionId - The ID of the session in which to mute or unmute streams. | ||
* @param {boolean} active - `true` to mute all streams, `false` to unmute all streams. | ||
* @param {string[]} excludedStreamIds - An optional array of stream IDs to exclude from muting/unmuting. | ||
* @return {Promise<ProjectDetailsResponse>} A promise that resolves to the updated session details. | ||
* | ||
* @example | ||
* ```ts | ||
* const forceMute = await videoClient.muteAll(SESSION_ID); | ||
* console.log(forceMute.status); | ||
* ``` | ||
*/ | ||
async muteAllStreams(sessionId, active, excludedStreamIds = []) { | ||
@@ -172,2 +541,15 @@ const resp = await this.sendPostRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/session/${sessionId}/mute`, { | ||
} | ||
/** | ||
* Mutes or unmutes a specific stream in a session. | ||
* | ||
* @param {string} sessionId - The ID of the session containing the stream. | ||
* @param {string} streamId - The ID of the stream to mute or unmute. | ||
* @return {Promise<ProjectDetailsResponse>} A promise that resolves to the updated session details. | ||
* | ||
* @example | ||
* ```ts | ||
* const forceMute = await videoClient.muteStream(SESSION_ID, STREAM_ID); | ||
* console.log(forceMute.status); | ||
* ``` | ||
*/ | ||
async muteStream(sessionId, streamId) { | ||
@@ -177,2 +559,15 @@ const resp = await this.sendPostRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/session/${sessionId}/stream/${streamId}/mute`); | ||
} | ||
/** | ||
* Sends DTMF (Dual-Tone Multi-Frequency) tones to a specific session or connection. | ||
* | ||
* @param {string} sessionId - The ID of the session to send DTMF tones to. | ||
* @param {string} digits - The DTMF tones to play. | ||
* @param {string} [connectionId] - Optional. The ID of the connection within the session to send DTMF tones to. | ||
* @return {Promise<void>} A promise that resolves when the DTMF tones have been played. | ||
* | ||
* @example | ||
* ```ts | ||
* await videoClient.playDTMF(SESSION_ID, '1234'); | ||
* ``` | ||
*/ | ||
async playDTMF(sessionId, digits, connectionId) { | ||
@@ -185,8 +580,57 @@ let url = `${this.config.videoHost}/v2/project/${this.auth.applicationId}/session/${sessionId}/play-dtmf`; | ||
} | ||
/** | ||
* Removes a stream from an archive. | ||
* | ||
* @param {string} archiveId - The ID of the archive from which to remove the stream. | ||
* @param {string} streamId - The ID of the stream to remove from the archive. | ||
* @return {Promise<void>} A promise that resolves when the stream has been successfully removed from the archive. | ||
* | ||
* @example | ||
* ```ts | ||
* await videoClient.removeArchiveStream(ARCHIVE_ID, STREAM_ID); | ||
* ``` | ||
*/ | ||
async removeArchiveStream(archiveId, streamId) { | ||
await this.sendPatchRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/archive/${archiveId}/stream`, { removeStream: streamId }); | ||
} | ||
/** | ||
* Removes a stream from a broadcast. | ||
* | ||
* @param {string} broadcastId - The ID of the broadcast from which to remove the stream. | ||
* @param {string} streamId - The ID of the stream to remove from the broadcast. | ||
* @return {Promise<void>} A promise that resolves when the stream has been successfully removed from the broadcast. | ||
* | ||
* @example | ||
* ```ts | ||
* await videoClient.removeStreamFromBroadcast(BROADCAST_ID, STREAM_ID); | ||
* ``` | ||
*/ | ||
async removeStreamFromBroadcast(broadcastId, streamId) { | ||
await this.updateBroadcast({ broadcastId, removeStream: streamId }); | ||
} | ||
/** | ||
* Searches for archives based on the specified filter criteria. | ||
* | ||
* @param {ArchiveSearchFilter} [filter] - Optional filter criteria to narrow down the search. | ||
* @return {Promise<MultiArchiveResponse>} A promise that resolves with the search results, including multiple archive items. | ||
* | ||
* @example | ||
* ```ts | ||
* const archives = await videoClient.searchArchives(); | ||
* for (const archive of archives.items) { | ||
* console.log(archive.id); | ||
* } | ||
* ``` | ||
* @example | ||
* Search for archives for a session | ||
* ```ts | ||
* const archives = await videoClient.searchArchives({ | ||
* sessionId: SESSION_ID, | ||
* }); | ||
* | ||
* for (const archive of archives.items) { | ||
* console.log(archive.id); | ||
* } | ||
* ``` | ||
*/ | ||
async searchArchives(filter) { | ||
@@ -196,2 +640,27 @@ const resp = await this.sendGetRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/archive`, filter); | ||
} | ||
/** | ||
* Searches for broadcasts based on the specified filter criteria. | ||
* | ||
* @param {BroadcastSearchFilter} [filter] - Optional filter criteria to narrow down the search. | ||
* @return {Promise<MultiBroadcastResponse>} A promise that resolves with the search results, including multiple broadcast items. | ||
* | ||
* @example | ||
* ```ts | ||
* const broadcasts = await videoClient.searchBroadcasts(); | ||
* for (const broadcast of broadcasts.items) { | ||
* console.log(broadcast.id); | ||
* } | ||
* ``` | ||
* | ||
* @example | ||
* Get braodcasts for a session | ||
* ```ts | ||
* const broadcasts = await videoClient.searchBroadcasts({ | ||
* sessionId: SESSION_ID, | ||
* }) | ||
* for (const broadcast of broadcasts.items) { | ||
* console.log(broadcast.id); | ||
* } | ||
* ``` | ||
*/ | ||
async searchBroadcasts(filter) { | ||
@@ -201,2 +670,20 @@ const resp = await this.sendGetRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/broadcast/`, filter); | ||
} | ||
/** | ||
* Sends a signal to a session or a specific connection within a session. | ||
* | ||
* @param {Signal} signal - The signal to send, including a type and data. | ||
* @param {string} sessionId - The ID of the session to which the signal will be sent. | ||
* @param {string} [connectionId] - Optional. The ID of the connection within the session to which the signal will be sent. If not provided, the signal will be sent to the entire session. | ||
* @return {Promise<void>} A promise that resolves when the signal is successfully sent. | ||
* | ||
* @example | ||
* await videoClient.sendSignal( | ||
* { | ||
* type: 'text', | ||
* data: 'Hello world!', | ||
* }, | ||
* SESSION_ID, | ||
* ); | ||
* ``` | ||
*/ | ||
async sendSignal(signal, sessionId, connectionId) { | ||
@@ -209,5 +696,39 @@ let url = `${this.config.videoHost}/v2/project/${this.auth.applicationId}/session/${sessionId}/signal`; | ||
} | ||
/** | ||
* Sets the stream class lists for one or more streams within a session. | ||
* | ||
* @param {string} sessionId - The ID of the session for which stream class lists will be set. | ||
* @param {StreamClassList[]} settings - An array of objects specifying the stream ID and corresponding class lists to be set. | ||
* @return {Promise<void>} A promise that resolves when the stream class lists are successfully set. | ||
* | ||
* @example | ||
* | ||
* ```ts | ||
* await videoClient.setStreamClassLists( | ||
* SESSION_ID, | ||
* [ | ||
* { | ||
* id: STREAM_ID, | ||
* layoutClassList: ['full'], | ||
* } | ||
* ] | ||
* ) | ||
* ``` | ||
*/ | ||
async setStreamClassLists(sessionId, settings) { | ||
await this.sendPutRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/session/${sessionId}/stream`, { items: settings }); | ||
} | ||
/** | ||
* Starts an archive for a given session with optional configuration. | ||
* | ||
* @param {string} sessionId - The ID of the session to archive. | ||
* @param {ArchiveOptions} [options] - Optional configuration for the archive, such as audio/video settings, layout, and more. | ||
* @return {Promise<SingleArchiveResponse>} A promise that resolves with information about the started archive. | ||
* | ||
* @example | ||
* ```ts | ||
* const archive = await videoClient.startArchive(SESSION_ID); | ||
* console.log(archive.id); | ||
* ``` | ||
*/ | ||
async startArchive(sessionId, options) { | ||
@@ -218,2 +739,26 @@ const data = Object.assign({}, { sessionId }, options); | ||
} | ||
/** | ||
* Starts a broadcast for a given session with the specified configuration. | ||
* | ||
* @param {string} sessionId - The ID of the session to start broadcasting. | ||
* @param {BroadcastConfig} config - Configuration for the broadcast, including stream settings, layout, and more. | ||
* @return {Promise<BroadcastDetailsResponse>} A promise that resolves with information about the started broadcast. | ||
* | ||
* @example | ||
* ```ts | ||
* const broadcast = await videoClient.startBroadcast( | ||
* SESSION_ID, | ||
* { | ||
* outputs: { | ||
* hls: { | ||
* lowLatency: true, | ||
* } | ||
* rtmp: [{ | ||
* serverUrl: 'rtmp://example.com', | ||
* }], | ||
* } | ||
* } | ||
* ); | ||
* ``` | ||
*/ | ||
async startBroadcast(sessionId, config) { | ||
@@ -224,2 +769,21 @@ const data = Object.assign({}, { sessionId }, config); | ||
} | ||
/** | ||
* Starts rendering an experience composer with the provided configuration. | ||
* | ||
* @param {string} sessionId - The ID of the session associated with the experience composer. | ||
* @param {string} token - The client token for authentication. | ||
* @param {ExperienceComposerOptions} config - Configuration options for the experience composer rendering. | ||
* @return {Promise<ExperienceComposerResponse>} A promise that resolves with information about the started experience composer rendering. | ||
* | ||
* @example | ||
* ```ts | ||
* | ||
* const render = await videoClient.startExperienceComposerRender( | ||
* SESSION_ID, | ||
* token, | ||
* ) | ||
* | ||
* console.log(render.id); | ||
* ``` | ||
*/ | ||
async startExperienceComposerRender(sessionId, token, config) { | ||
@@ -230,2 +794,15 @@ const data = Object.assign({}, { sessionId, token }, config); | ||
} | ||
/** | ||
* Stops an archive with the given archive ID. | ||
* | ||
* @param {string} archiveId - The ID of the archive to stop. | ||
* @return {Promise<SingleArchiveResponse>} A promise that resolves with information about the stopped archive. | ||
* | ||
* @example | ||
* ```ts | ||
* const archive = await videoClient.stopArchive(ARCHIVE_ID); | ||
* | ||
* console.log(archive.status); | ||
* ``` | ||
*/ | ||
async stopArchive(archiveId) { | ||
@@ -235,2 +812,14 @@ const resp = await this.sendPostRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/archive/${archiveId}/stop`); | ||
} | ||
/** | ||
* Stops a broadcast with the given broadcast ID. | ||
* | ||
* @param {string} broadcastId - The ID of the broadcast to stop. | ||
* @return {Promise<BroadcastDetailsResponse>} A promise that resolves with information about the stopped broadcast. | ||
* | ||
* @example | ||
* ```ts | ||
* const broadcast = await videoClient.stopBroadcast(BROADCAST_ID); | ||
* console.log(broadcast.status); | ||
* ``` | ||
*/ | ||
async stopBroadcast(broadcastId) { | ||
@@ -240,9 +829,46 @@ const resp = await this.sendPostRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/broadcast/${broadcastId}/stop`); | ||
} | ||
/** | ||
* Stops an Experience Composer render with the given render ID. | ||
* | ||
* @param {string} renderId - The ID of the Experience Composer render to stop. | ||
* @return {Promise<void>} A promise that resolves when the render is successfully stopped. | ||
* | ||
* @example | ||
* ```ts | ||
* await videoClient.stopExperienceComposerRender(RENDER_ID); | ||
* ``` | ||
*/ | ||
async stopExperienceComposerRender(renderId) { | ||
await this.sendDeleteRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/render/${renderId}`); | ||
} | ||
/** | ||
* Updates the layout of an archive with the given archive ID. | ||
* | ||
* @param {string} archiveId - The ID of the archive to update the layout for. | ||
* @param {ArchiveLayout} layout - The new layout configuration to set for the archive. | ||
* @return {Promise<void>} A promise that resolves when the layout is successfully updated. | ||
* | ||
* @example | ||
* ```ts | ||
* await videoClient.updateArchiveLayout( | ||
* ``` | ||
*/ | ||
async updateArchiveLayout(archiveId, layout) { | ||
const resp = await this.sendPutRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/archive/${archiveId}/layout`, layout); | ||
return resp.data; | ||
await this.sendPutRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/archive/${archiveId}/layout`, layout); | ||
} | ||
/** | ||
* Updates the configuration of a broadcast with the given broadcast ID. | ||
* | ||
* @param {BroadcastUpdateConfig} config - The configuration options to update the broadcast. | ||
* @return {Promise<void>} A promise that resolves when the broadcast is successfully updated. | ||
* | ||
* @example | ||
* ```ts | ||
* | ||
* await videoClient.updateBroadcast({ | ||
* broadcastId: BROADCAST_ID, | ||
* hasAudio: true, | ||
* }) | ||
* ``` | ||
*/ | ||
async updateBroadcast(config) { | ||
@@ -253,2 +879,1 @@ await this.sendPatchRequest(`${this.config.videoHost}/v2/project/${this.auth.applicationId}/broadcast/${config.broadcastId}/streams`, config); | ||
exports.Video = Video; | ||
//# sourceMappingURL=video.js.map |
{ | ||
"$schema": "https://json.schemastore.org/package.json", | ||
"name": "@vonage/video", | ||
"version": "1.13.0", | ||
"version": "1.14.0", | ||
"description": "Package to interact with the Vonage Video API (Not OpenTok Compatible)", | ||
@@ -18,3 +19,12 @@ "keywords": [ | ||
"license": "Apache-2.0", | ||
"author": "Chris Tankersley <chris@ctankersley.com>", | ||
"contributors": [ | ||
{ | ||
"name": "Chris Tankersley", | ||
"url": "https://github.com/dragonmantank" | ||
}, | ||
{ | ||
"name": "Chuck \"MANCHUCK\" Reeves", | ||
"url": "https://github.com/manchuck" | ||
} | ||
], | ||
"main": "dist/index.js", | ||
@@ -32,9 +42,10 @@ "types": "dist/index.d.ts", | ||
"clean": "npx shx rm -rf dist tsconfig.tsbuildinfo", | ||
"compile": "npx tsc --build --verbose" | ||
"compile": "npx tsc --build --verbose", | ||
"prepublishOnly": "npm run build" | ||
}, | ||
"dependencies": { | ||
"@vonage/auth": "^1.7.0", | ||
"@vonage/jwt": "^1.7.0", | ||
"@vonage/server-client": "^1.9.0", | ||
"@vonage/vetch": "^1.6.0" | ||
"@vonage/auth": "^1.8.0", | ||
"@vonage/jwt": "^1.8.0", | ||
"@vonage/server-client": "^1.10.0", | ||
"@vonage/vetch": "^1.7.0" | ||
}, | ||
@@ -47,4 +58,3 @@ "devDependencies": { | ||
"directory": "dist" | ||
}, | ||
"gitHead": "328f18e5c8a458cb4d06d7955ec2399a6ce6f5d8" | ||
} | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
112078
3043
100
1
Updated@vonage/auth@^1.8.0
Updated@vonage/jwt@^1.8.0
Updated@vonage/vetch@^1.7.0