-
Notifications
You must be signed in to change notification settings - Fork 181
Vonage Video
Vonage Video • Docs
Documentation / Vonage Video
Enum representing different archive modes.
Enumeration Member | Value | Description | Defined in |
---|---|---|---|
ALWAYS |
"always" |
Archive mode set to 'always', where archives are continuously recorded. | video/lib/types/ArchiveMode.ts:13 |
MANUAL |
"manual" |
Archive mode set to 'manual', where archives are started and stopped manually. | video/lib/types/ArchiveMode.ts:8 |
Enum representing different output modes for video archives.
Enumeration Member | Value | Description | Defined in |
---|---|---|---|
COMPOSED |
"composed" |
Represents the composed output mode where all streams are mixed into one. | video/lib/enums/ArchiveOutputMode.ts:8 |
INDIVIDUAL |
"individual" |
Represents the individual output mode where each stream is recorded separately. | video/lib/enums/ArchiveOutputMode.ts:13 |
Enum representing different audio sample rates.
Enumeration Member | Value | Description | Defined in |
---|---|---|---|
16KHZ |
16000 |
Represents an audio sample rate of 16 kHz. | video/lib/enums/AudioRate.ts:8 |
8KHZ |
8000 |
Represents an audio sample rate of 8 kHz. | video/lib/enums/AudioRate.ts:13 |
Enum representing different captioning status.
Enumeration Member | Value | Description | Defined in |
---|---|---|---|
FAILED |
"failed" |
Indicates that captioning has failed. | video/lib/enums/CaptionStatus.ts:23 |
PAUSED |
"paused" |
Indicates that captioning has been paused. | video/lib/enums/CaptionStatus.ts:18 |
STARTED |
"started" |
Indicates that captioning has started. | video/lib/enums/CaptionStatus.ts:8 |
STOPPED |
"stopped" |
Indicates that captioning has stopped. | video/lib/enums/CaptionStatus.ts:13 |
Enum representing different resolutions for an experience composer.
Enumeration Member | Value | Description | Defined in |
---|---|---|---|
HD_LANDSCAPE |
"1280x720" |
High definition landscape resolution. | video/lib/enums/ExperienceComposerResolution.ts:20 |
HD_PORTRAIT |
"720x1280" |
High definition portrait resolution. | video/lib/enums/ExperienceComposerResolution.ts:25 |
SD_LANDSCAPE |
"640x480" |
Standard definition landscape resolution. | video/lib/enums/ExperienceComposerResolution.ts:10 |
SD_PORTRAIT |
"480x640" |
Standard definition portrait resolution. | video/lib/enums/ExperienceComposerResolution.ts:15 |
Enum representing different layout types for live streaming broadcasts.
Enumeration Member | Value | Description | Defined in |
---|---|---|---|
BEST_FIT |
"bestFit" |
Automatically determine the best fit layout. | video/lib/enums/LayoutType.ts:8 |
CUSTOM |
"custom" |
Use a custom layout for the broadcast. | video/lib/enums/LayoutType.ts:13 |
HORIZONTAL_PRESENTATION |
"horizontalPresentation" |
Horizontal presentation layout. | video/lib/enums/LayoutType.ts:18 |
PIP |
"pip" |
Picture-in-picture (PIP) layout. | video/lib/enums/LayoutType.ts:23 |
VERTICAL_PRESENTATION |
"verticalPresentation" |
Vertical presentation layout. | video/lib/enums/LayoutType.ts:28 |
Enum representing media modes for a session.
Enumeration Member | Value | Description | Defined in |
---|---|---|---|
RELAYED |
"enabled" |
Relayed mode where media is enabled. | video/lib/enums/MediaMode.ts:13 |
ROUTED |
"disabled" |
Routed mode where media is disabled. | video/lib/enums/MediaMode.ts:8 |
Enum representing different video resolutions for live streaming broadcasts.
Enumeration Member | Value | Description | Defined in |
---|---|---|---|
FHD_LANDSCAPE |
"1920x1080" |
Full HD landscape resolution (1920x1080 pixels). | video/lib/enums/Resolution.ts:8 |
FHD_PORTRAIT |
"1080x1920" |
Full HD portrait resolution (1080x1920 pixels). | video/lib/enums/Resolution.ts:13 |
HD_LANDSCAPE |
"1280x720" |
HD landscape resolution (1280x720 pixels). | video/lib/enums/Resolution.ts:18 |
HD_PORTRAIT |
"720x1280" |
HD portrait resolution (720x1280 pixels). | video/lib/enums/Resolution.ts:23 |
SD_LANDSCAPE |
"640x480" |
Standard definition landscape resolution (640x480 pixels). | video/lib/enums/Resolution.ts:28 |
SD_PORTRAIT |
"480x640" |
Standard definition portrait resolution (480x640 pixels). | video/lib/enums/Resolution.ts:33 |
Enum representing different stream modes for live streaming broadcasts.
Enumeration Member | Value | Description | Defined in |
---|---|---|---|
AUTO |
"auto" |
Streams are selected automatically based on session rules. | video/lib/enums/StreamMode.ts:8 |
MANUAL |
"manual" |
Streams are manually selected for inclusion in the broadcast. | video/lib/enums/StreamMode.ts:13 |
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.
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.
Create a standalone Video client
import { Video } from '@vonage/video';
const videoClient = new Video({
apiKey: VONAGE_API_KEY,
apiSecret: VONAGE_API_SECRET
});
Create an Video client from the Vonage client
import { Vonage } from '@vonage/server-client';
const vonage = new Vonage({
apiKey: VONAGE_API_KEY,
apiSecret: VONAGE_API_SECRET
});
const videoClient = vonage.video;
new Video(credentials, options?): Video
Creates a new instance of the Client.
• credentials: AuthParams
| AuthInterface
The authentication credentials or an authentication instance.
• options?: ConfigParams
Optional configuration settings for the client.
server-client/dist/lib/client.d.ts:35
protected auth: AuthInterface;
The authentication instance responsible for generating authentication headers and query parameters.
server-client/dist/lib/client.d.ts:24
protected authType: AuthenticationType = AuthenticationType.JWT;
The type of authentication used for the client's requests.
protected config: ConfigParams;
Configuration settings for the client, including default hosts for various services and other request settings.
server-client/dist/lib/client.d.ts:28
static transformers: object;
Static property containing utility transformers.
camelCaseObjectKeys: PartialTransformFunction;
kebabCaseObjectKeys: PartialTransformFunction;
omit: (keys, obj) => TransformedObject;
• keys: string
[]
• obj: ObjectToTransform
snakeCaseObjectKeys: PartialTransformFunction;
server-client/dist/lib/client.d.ts:11
addArchiveStream(
archiveId,
streamId,
audio?,
video?): Promise<void>
Adds a stream to an existing archive, allowing you to include additional streams in the archive recording.
• archiveId: string
The ID of the archive to which you want to add a stream.
• streamId: string
The ID of the stream you want to add to the archive.
• audio?: boolean
= true
Whether to include audio from the added stream (default: true).
• video?: boolean
= true
Whether to include video from the added stream (default: true).
Promise
<void
>
A promise that resolves when the stream has been successfully added to the archive.
If an error occurs while adding the stream to the archive.
await videoClient.addArchiveStream(ARCHIVE_ID, STREAM_ID);
addAuthenticationToRequest(request): Promise<VetchOptions>
Adds the appropriate authentication headers or parameters to the request based on the authentication type.
• request: VetchOptions
The request options to which authentication needs to be added.
Promise
<VetchOptions
>
- The request options with the added authentication.
Client
.addAuthenticationToRequest
server-client/dist/lib/client.d.ts:43
protected addBasicAuthToRequest(request): Promise<VetchOptions>
Adds basic authentication headers to the request.
• request: VetchOptions
The request options to which authentication needs to be added.
Promise
<VetchOptions
>
- The request options with the added authentication.
server-client/dist/lib/client.d.ts:71
protected addJWTToRequest(request): Promise<VetchOptions>
Adds a JWT to the request.
• request: VetchOptions
The request options to which authentication needs to be added.
Promise
<VetchOptions
>
- The request options with the added authentication.
server-client/dist/lib/client.d.ts:64
protected addQueryKeySecretToRequest(request): Promise<VetchOptions>
Adds API key and secret to the request.
• request: VetchOptions
The request options to which authentication needs to be added.
Promise
<VetchOptions
>
- The request options with the added authentication.
Client
.addQueryKeySecretToRequest
server-client/dist/lib/client.d.ts:57
protected addQueryKeySecretToRequestBody(request): Promise<VetchOptions>
Adds API key and secret to the request body.
• request: VetchOptions
The request options to which authentication needs to be added.
Promise
<VetchOptions
>
- The request options with the added authentication.
Client
.addQueryKeySecretToRequestBody
server-client/dist/lib/client.d.ts:50
addStreamToBroadcast(broadcastId, streamId): Promise<void>
Adds a stream to an existing broadcast, allowing you to include additional streams in the live broadcast.
• broadcastId: string
The ID of the broadcast to which you want to add a stream.
• streamId: string
The ID of the stream you want to add to the broadcast.
Promise
<void
>
A promise that resolves when the stream has been successfully added to the broadcast.
If an error occurs while adding the stream to the broadcast.
await videoClient.addStreamToBroadcast(BROADCAST_ID, STREAM_ID);
connectToWebsocket(
sessionId,
clientToken,
config): Promise<WebSocketConnectResponse>
Connects to a WebSocket for a specified session using the provided client token and WebSocket configuration.
• sessionId: string
The ID of the session to which you want to connect via WebSocket.
• clientToken: string
The client token generated for authentication.
• config: WebSocketConfig
The WebSocket configuration specifying the URI and optional parameters.
Promise
<WebSocketConnectResponse
>
A promise that resolves with WebSocket connection details upon successful connection.
If an error occurs during the WebSocket connection process.
const result = await videoClient.connectToWebsocket(
SESSION_ID,
CLIENT_TOKEN,
{
uri: 'wss://example.com',
},
)
console.log(result.id);
createSession(sessionOptions?): Promise<Session>
Creates a new session with the specified options.
• sessionOptions?
Optional session configuration options.
• sessionOptions.archiveMode?: ArchiveMode
The archive mode for the session.
• sessionOptions.location?: string
The location for the session.
• sessionOptions.mediaMode?: MediaMode
The media mode for the session.
Promise
<Session
>
A promise that resolves with details of the newly created session.
If an error occurs during the session creation process.
Create a session with default options
const session = await videoClient.createSession({});
console.log(session.sessionId);
Create a session with archive mode set to manual
import { ArchiveMode } from '@vonage/video';
const session = await videoClient.createSession({
archiveMode: ArchiveMode.MANUAL,
});
console.log(session.sessionId);
Create a session with location set to a specific region
const session = await videoClient.createSession({
location: 'eu',
});
console.log(session.sessionId);
Create a session with media mode set to routed
import { MediaMode } from '@vonage/video';
const session = await videoClient.createSession({
mediaMode: MediaMode.ROUTED,
});
console.log(session.sessionId);
deleteArchive(archiveId): Promise<void>
Deletes an archive with the specified archive ID.
• archiveId: string
The ID of the archive to delete.
Promise
<void
>
A promise that resolves when the archive is successfully deleted.
If an error occurs while deleting the archive or if the archive with the given ID does not exist.
await videoClient.deleteArchive(ARCHIVE_ID);
disableCaptions(captionId): Promise<void>
Disables captions for a specific caption ID.
• captionId: string
The ID of the caption to disable.
Promise
<void
>
A promise that resolves when the captions are successfully disabled.
If an error occurs while disabling captions or if the caption with the given ID does not exist.
await videoClient.disableCaptions(CAPTION_ID);
disableForceMute(sessionId, excludedStreamIds): Promise<ProjectDetailsResponse>
Disables force mute for a session, allowing audio for all streams.
• sessionId: string
The ID of the session for which to disable force mute.
• excludedStreamIds: string
[] = []
An optional array of stream IDs to exclude from the force mute operation.
Promise
<ProjectDetailsResponse
>
A promise that resolves when the force mute is successfully disabled for the session.
If an error occurs while disabling force mute or if the session with the given ID does not exist.
const forceMute = await videoClient.disableForceMute(SESSION_ID);
console.log(forceMute.status);
disconnectClient(sessionId, connectionId): Promise<void>
Disconnects a client from a session.
• sessionId: string
The ID of the session from which to disconnect the client.
• connectionId: string
The ID of the client's connection to disconnect.
Promise
<void
>
A promise that resolves when the client is successfully disconnected from the session.
If an error occurs while disconnecting the client or if the session or connection with the given IDs do not exist.
await videoClient.disconnectClient(SESSION_ID, CONNECTION_ID);
disconnectWebsocket(callId): Promise<void>
Disconnects a WebSocket connection associated with a call or session.
• callId: string
The ID of the call or session to which the WebSocket connection is associated.
Promise
<void
>
A promise that resolves when the WebSocket connection is successfully disconnected.
If an error occurs while disconnecting the WebSocket connection or if the call or session with the given ID does not exist.
await videoClient.disconnectWebsocket(CALL_ID);
enableCaptions(
sessionId,
clientToken,
captionOptions?): Promise<EnableCaptionResponse>
Enables captions for a session using the specified client token and caption options.
• sessionId: string
The ID of the session to enable captions for.
• clientToken: string
The client token associated with the session, used for authentication.
• captionOptions?: CaptionOptions
= {}
Optional caption options to configure caption behavior.
Promise
<EnableCaptionResponse
>
A promise that resolves with an EnableCaptionResponse
containing information about the enabled captions.
If an error occurs while enabling captions or if the session with the given ID does not exist.
const result = await videoClient.enableCaptions(SESSION_ID, CLIENT_TOKEN);
console.log(result.captionId);
forceMuteAll(sessionId, excludedStreamIds?): Promise<ProjectDetailsResponse>
Forces muting of all streams in a session, except those specified in the excludedStreamIds
array.
• sessionId: string
The ID of the session in which to force mute streams.
• excludedStreamIds?: string
[] = []
An optional array of stream IDs to exclude from muting.
Promise
<ProjectDetailsResponse
>
A promise that resolves with a ProjectDetailsResponse
containing updated session details after muting.
If an error occurs while muting the streams or if the session with the given ID does not exist.
const forceMute = await videoClient.forceMuteAll(SESSION_ID);
console.log(forceMute.status);
generateClientToken(sessionId, tokenOptions?): string
Generates a client token for connecting to a session with the specified options.
• sessionId: string
The ID of the session to generate the client token for.
• tokenOptions?: ClientTokenOptions
Optional token options including role, data, and expiration time.
string
A client token that can be used for authentication when connecting to a session.
const token = videoClient.generateClientToken(SESSION_ID);
console.log(`The token is ${token}`);
getArchive(archiveId): Promise<SingleArchiveResponse>
Retrieves information about a specific archive by its ID.
• archiveId: string
The ID of the archive to retrieve.
Promise
<SingleArchiveResponse
>
A promise that resolves to the details of the requested archive.
const archive = await videoClient.getArchive(ARCHIVE_ID);
console.log(archive.createdAt);
getBroadcast(broadcastId): Promise<BroadcastDetailsResponse>
Retrieves information about a specific broadcast by its ID.
• broadcastId: string
The ID of the broadcast to retrieve.
Promise
<BroadcastDetailsResponse
>
A promise that resolves to the details of the requested broadcast.
const broadcast = await videoClient.getBroadcast(BROADCAST_ID);
console.log(broadcast.createdAt);
getCaptionStatus(captionId): Promise<CaptionStatusResponse>
Retrieves the status of a caption by its ID.
• captionId: string
The ID of the caption to retrieve the status for.
Promise
<CaptionStatusResponse
>
A promise that resolves to the status of the requested caption.
const captionStatus = await videoClient.getCaptionStatus(CAPTION_ID);
console.log(captionStatus.status);
getConfig(): ConfigParams
server-client/dist/lib/client.d.ts:36
getExperienceComposerRender(renderId): Promise<ExperienceComposerResponse>
Retrieves the details of an Experience Composer render by its ID.
• renderId: string
The ID of the Experience Composer render to retrieve.
Promise
<ExperienceComposerResponse
>
A promise that resolves to the details of the requested Experience Composer render.
const render = await videoClient.getExperienceComposerRender(RENDER_ID);
console.log(render.createdAt);
getStreamInfo(sessionId, streamId?): Promise<SingleStreamLayoutResponse | MultiStreamLayoutResponse>
Retrieves information about one or more streams in a session.
• sessionId: string
The ID of the session to retrieve stream information from.
• streamId?: string
Optional. The ID of a specific stream to retrieve information for.
Promise
<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).
const streamInfo = await videoClient.getStreamInfo(SESSION_ID);
if (streamInfo.items) {
streamInfo.items.forEach((item) => {
console.log(item.id);
});
} else {
console.log(streamInfo.id);
}
intiateSIPCall(sessionId, options): Promise<SIPCallResponse>
Initiates a SIP call within a session.
• sessionId: string
The ID of the session in which to initiate the SIP call.
• options: SIPCallOptions
The options for initiating the SIP call.
Promise
<SIPCallResponse
>
A promise that resolves to the SIP call response, including the call ID and other details.
Start a SIP call with default options
const sipCall = await videoClient.intiateSIPCall(SESSION_ID);
console.log(sipCall.id);
Start a SIP call with custom options
const sipCall = await videoClient.intiateSIPCall(
SESSION_ID,
{
uri: 'sip://example.com',
}
);
console.log(sipCall.id);
listExperienceComposerRenders(filter): Promise<MultiExperienceComposerResponse>
Lists Experience Composer renders based on the specified filter criteria.
• filter: ExperienceComposerListFilter
An optional filter to apply when listing Experience Composer renders.
Promise
<MultiExperienceComposerResponse
>
A promise that resolves to a list of Experience Composer renders matching the filter criteria.
const renders = await videoClient.listExperienceComposerRenders();
for (const render of renders.items) {
console.log(render.id);
}
protected muteAllStreams(
sessionId,
active,
excludedStreamIds): Promise<ProjectDetailsResponse>
Mutes or unmutes all streams in a session, optionally excluding specific stream IDs from muting.
• sessionId: string
The ID of the session in which to mute or unmute streams.
• active: boolean
true
to mute all streams, false
to unmute all streams.
• excludedStreamIds: string
[] = []
An optional array of stream IDs to exclude from muting/unmuting.
Promise
<ProjectDetailsResponse
>
A promise that resolves to the updated session details.
const forceMute = await videoClient.muteAll(SESSION_ID);
console.log(forceMute.status);
muteStream(sessionId, streamId): Promise<ProjectDetailsResponse>
Mutes or unmutes a specific stream in a session.
• sessionId: string
The ID of the session containing the stream.
• streamId: string
The ID of the stream to mute or unmute.
Promise
<ProjectDetailsResponse
>
A promise that resolves to the updated session details.
const forceMute = await videoClient.muteStream(SESSION_ID, STREAM_ID);
console.log(forceMute.status);
protected parseResponse<T>(request, response): Promise<VetchResponse<T>>
Parses the response based on its content type.
• T
The expected type of the parsed response data.
• request: VetchOptions
The request options.
• response: Response
The raw response from the request.
Promise
<VetchResponse
<T
>>
- The parsed response.
server-client/dist/lib/client.d.ts:168
playDTMF(
sessionId,
digits,
connectionId?): Promise<void>
Sends DTMF (Dual-Tone Multi-Frequency) tones to a specific session or connection.
• sessionId: string
The ID of the session to send DTMF tones to.
• digits: string
The DTMF tones to play.
• connectionId?: string
Optional. The ID of the connection within the session to send DTMF tones to.
Promise
<void
>
A promise that resolves when the DTMF tones have been played.
await videoClient.playDTMF(SESSION_ID, '1234');
protected prepareBody(request): undefined | string
Prepares the body for the request based on the content type.
• request: VetchOptions
The request options.
undefined
| string
- The prepared request body as a string or undefined.
server-client/dist/lib/client.d.ts:158
protected prepareRequest(request): Promise<VetchOptions>
Prepares the request with necessary headers, authentication, and query parameters.
• request: VetchOptions
The initial request options.
Promise
<VetchOptions
>
- The modified request options.
server-client/dist/lib/client.d.ts:151
removeArchiveStream(archiveId, streamId): Promise<void>
Removes a stream from an archive.
• archiveId: string
The ID of the archive from which to remove the stream.
• streamId: string
The ID of the stream to remove from the archive.
Promise
<void
>
A promise that resolves when the stream has been successfully removed from the archive.
await videoClient.removeArchiveStream(ARCHIVE_ID, STREAM_ID);
removeStreamFromBroadcast(broadcastId, streamId): Promise<void>
Removes a stream from a broadcast.
• broadcastId: string
The ID of the broadcast from which to remove the stream.
• streamId: string
The ID of the stream to remove from the broadcast.
Promise
<void
>
A promise that resolves when the stream has been successfully removed from the broadcast.
await videoClient.removeStreamFromBroadcast(BROADCAST_ID, STREAM_ID);
searchArchives(filter?): Promise<MultiArchiveResponse>
Searches for archives based on the specified filter criteria.
• filter?: ArchiveSearchFilter
Optional filter criteria to narrow down the search.
Promise
<MultiArchiveResponse
>
A promise that resolves with the search results, including multiple archive items.
const archives = await videoClient.searchArchives();
for (const archive of archives.items) {
console.log(archive.id);
}
Search for archives for a session
const archives = await videoClient.searchArchives({
sessionId: SESSION_ID,
});
for (const archive of archives.items) {
console.log(archive.id);
}
searchBroadcasts(filter?): Promise<MultiBroadcastResponse>
Searches for broadcasts based on the specified filter criteria.
• filter?: BroadcastSearchFilter
Optional filter criteria to narrow down the search.
Promise
<MultiBroadcastResponse
>
A promise that resolves with the search results, including multiple broadcast items.
const broadcasts = await videoClient.searchBroadcasts();
for (const broadcast of broadcasts.items) {
console.log(broadcast.id);
}
Get braodcasts for a session
const broadcasts = await videoClient.searchBroadcasts({
sessionId: SESSION_ID,
})
for (const broadcast of broadcasts.items) {
console.log(broadcast.id);
}
sendDeleteRequest<T>(url): Promise<VetchResponse<T>>
Sends a DELETE request to the specified URL.
• T
• url: string
The URL endpoint for the DELETE request.
Promise
<VetchResponse
<T
>>
- The response from the DELETE request.
server-client/dist/lib/client.d.ts:78
sendFormSubmitRequest<T>(url, payload?): Promise<VetchResponse<T>>
Sends a POST request with form data to the specified URL.
• T
• url: string
The URL endpoint for the POST request.
• payload?: Record
<string
, undefined
| string
>
Optional payload containing form data to send with the POST request.
Promise
<VetchResponse
<T
>>
- The response from the POST request.
server-client/dist/lib/client.d.ts:86
sendGetRequest<T>(url, queryParams?): Promise<VetchResponse<T>>
Sends a GET request to the specified URL with optional query parameters.
• T
• url: string
The URL endpoint for the GET request.
• queryParams?
Optional query parameters to append to the URL. These should be compatible with Node's URLSearchParams.
Promise
<VetchResponse
<T
>>
- The response from the GET request.
server-client/dist/lib/client.d.ts:94
sendPatchRequest<T>(url, payload?): Promise<VetchResponse<T>>
Sends a PATCH request to the specified URL with an optional payload.
• T
• url: string
The URL endpoint for the PATCH request.
• payload?
Optional payload to be sent as the body of the PATCH request.
Promise
<VetchResponse
<T
>>
- The response from the PATCH request.
server-client/dist/lib/client.d.ts:104
sendPostRequest<T>(url, payload?): Promise<VetchResponse<T>>
Sends a POST request to the specified URL with an optional payload.
• T
• url: string
The URL endpoint for the POST request.
• payload?
Optional payload to be sent as the body of the POST request.
Promise
<VetchResponse
<T
>>
- The response from the POST request.
server-client/dist/lib/client.d.ts:114
sendPutRequest<T>(url, payload?): Promise<VetchResponse<T>>
Sends a PUT request to the specified URL with an optional payload.
• T
• url: string
The URL endpoint for the PUT request.
• payload?
Optional payload to be sent as the body of the PUT request.
Promise
<VetchResponse
<T
>>
- The response from the PUT request.
server-client/dist/lib/client.d.ts:124
sendRequest<T>(request): Promise<VetchResponse<T>>
Sends a request adding necessary headers, handling authentication, and parsing the response.
• T
• request: VetchOptions
The options defining the request, including URL, method, headers, and data.
Promise
<VetchResponse
<T
>>
- The parsed response from the request.
server-client/dist/lib/client.d.ts:144
sendRequestWithData<T>(
method,
url,
payload?): Promise<VetchResponse<T>>
Sends a request with JSON-encoded data to the specified URL using the provided HTTP method.
• T
• method: POST
| PUT
| PATCH
The HTTP method to be used for the request (only POST, PATCH, or PUT are acceptable).
• url: string
The URL endpoint for the request.
• payload?
Optional payload to be sent as the body of the request, JSON-encoded.
Promise
<VetchResponse
<T
>>
- The response from the request.
server-client/dist/lib/client.d.ts:135
sendSignal(
signal,
sessionId,
connectionId?): Promise<void>
Sends a signal to a session or a specific connection within a session.
• signal: Signal
The signal to send, including a type and data.
• sessionId: string
The ID of the session to which the signal will be sent.
• connectionId?: string
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.
Promise
<void
>
A promise that resolves when the signal is successfully sent.
await videoClient.sendSignal(
{
type: 'text',
data: 'Hello world!',
},
SESSION_ID,
);
###### Defined in
[video/lib/video.ts:861](https://github.com/Vonage/vonage-node-sdk/blob/998c56b0db7e5e7b374439c44b9eaae906276725/packages/video/lib/video.ts#L861)
##### setStreamClassLists()
```ts
setStreamClassLists(sessionId, settings): Promise<void>
Sets the stream class lists for one or more streams within a session.
• sessionId: string
The ID of the session for which stream class lists will be set.
• settings: StreamClassList
[]
An array of objects specifying the stream ID and corresponding class lists to be set.
Promise
<void
>
A promise that resolves when the stream class lists are successfully set.
await videoClient.setStreamClassLists(
SESSION_ID,
[
{
id: STREAM_ID,
layoutClassList: ['full'],
}
]
)
startArchive(sessionId, options?): Promise<SingleArchiveResponse>
Starts an archive for a given session with optional configuration.
• sessionId: string
The ID of the session to archive.
• options?: ArchiveOptions
Optional configuration for the archive, such as audio/video settings, layout, and more.
Promise
<SingleArchiveResponse
>
A promise that resolves with information about the started archive.
const archive = await videoClient.startArchive(SESSION_ID);
console.log(archive.id);
startBroadcast(sessionId, config): Promise<BroadcastDetailsResponse>
Starts a broadcast for a given session with the specified configuration.
• sessionId: string
The ID of the session to start broadcasting.
• config: BroadcastConfig
Configuration for the broadcast, including stream settings, layout, and more.
Promise
<BroadcastDetailsResponse
>
A promise that resolves with information about the started broadcast.
const broadcast = await videoClient.startBroadcast(
SESSION_ID,
{
outputs: {
hls: {
lowLatency: true,
}
rtmp: [{
serverUrl: 'rtmp://example.com',
}],
}
}
);
startExperienceComposerRender(
sessionId,
token,
config): Promise<ExperienceComposerResponse>
Starts rendering an experience composer with the provided configuration.
• sessionId: string
The ID of the session associated with the experience composer.
• token: string
The client token for authentication.
• config: ExperienceComposerOptions
Configuration options for the experience composer rendering.
Promise
<ExperienceComposerResponse
>
A promise that resolves with information about the started experience composer rendering.
const render = await videoClient.startExperienceComposerRender(
SESSION_ID,
token,
)
console.log(render.id);
stopArchive(archiveId): Promise<SingleArchiveResponse>
Stops an archive with the given archive ID.
• archiveId: string
The ID of the archive to stop.
Promise
<SingleArchiveResponse
>
A promise that resolves with information about the stopped archive.
const archive = await videoClient.stopArchive(ARCHIVE_ID);
console.log(archive.status);
stopBroadcast(broadcastId): Promise<BroadcastDetailsResponse>
Stops a broadcast with the given broadcast ID.
• broadcastId: string
The ID of the broadcast to stop.
Promise
<BroadcastDetailsResponse
>
A promise that resolves with information about the stopped broadcast.
const broadcast = await videoClient.stopBroadcast(BROADCAST_ID);
console.log(broadcast.status);
stopExperienceComposerRender(renderId): Promise<void>
Stops an Experience Composer render with the given render ID.
• renderId: string
The ID of the Experience Composer render to stop.
Promise
<void
>
A promise that resolves when the render is successfully stopped.
await videoClient.stopExperienceComposerRender(RENDER_ID);
updateArchiveLayout(archiveId, layout): Promise<void>
Updates the layout of an archive with the given archive ID.
• archiveId: string
The ID of the archive to update the layout for.
• layout: ArchiveLayout
The new layout configuration to set for the archive.
Promise
<void
>
A promise that resolves when the layout is successfully updated.
await videoClient.updateArchiveLayout(
updateBroadcast(config): Promise<void>
Updates the configuration of a broadcast with the given broadcast ID.
• config: BroadcastUpdateConfig
The configuration options to update the broadcast.
Promise
<void
>
A promise that resolves when the broadcast is successfully updated.
await videoClient.updateBroadcast({
broadcastId: BROADCAST_ID,
hasAudio: true,
})
type ArchiveLayout: object;
Represents the layout configuration for an archive.
optional screenshareType: string;
Optional: The screenshare layout type to use when there is a screen-sharing stream in the archive (only applicable if type is 'bestFit' and screenshareType is set).
optional stylesheet: string;
Optional: The stylesheet used for custom layout (only applicable if type is 'custom').
type: LayoutType;
The type of layout to be used for the archive.
video/lib/types/ArchiveLayout.ts:6
type ArchiveOptions: object;
Interface representing options for creating an archive.
optional hasAudio: boolean;
Flag indicating whether audio should be included in the archive.
optional hasVideo: boolean;
Flag indicating whether video should be included in the archive.
optional layout: ArchiveLayout;
Layout configuration for the archive.
optional name: string;
Name of the archive.
optional outputMode: ArchiveOutputMode;
Output mode for the archive.
optional resolution: Resolution;
Resolution for the archive.
optional streamMode: StreamMode;
Stream mode for the archive.
video/lib/types/ArchiveOptions.ts:7
type ArchiveSearchFilter: object;
Interface representing filters for searching archives.
optional count: number;
The number of archives to retrieve starting at the offset. Default is 50, with a maximum of 1000.
optional offset: number;
The start offset in the list of existing archives.
optional sessionId: string;
Retrieve archives for a specific session ID.
video/lib/types/ArchiveSearchFilter.ts:4
type BroadcastConfig: object;
Interface representing configuration options for a live streaming broadcast.
optional hasAudio: boolean;
Whether the broadcast has audio.
optional hasVideo: boolean;
Whether the broadcast has video.
optional layout: LayoutType;
The layout type for the broadcast.
optional maxBitrate: number;
The maximum bitrate for the stream.
optional maxDuration: number;
The maximum duration for the broadcast, in seconds. The broadcast will automatically stop when the maximum duration is reached.
optional multiBroadcastTag: string;
The unique tag for simultaneous broadcasts (if one was set).
outputs: BroadcastOutputs;
Configuration options for different types of broadcast streams (HLS and RTMP).
optional resolution: Resolution;
The resolution of the broadcast.
optional streamMode: StreamMode;
The stream mode for the broadcast.
video/lib/types/BroadcastConfig.ts:37
type BroadcastDetailsResponse: object;
Represents the response containing details about a live streaming broadcast.
applicationId: string;
The Vonage Application UUID.
broadcastUrls: object;
An object containing details about the HLS and RTMP broadcasts.
optional broadcastUrls.hls: string;
The URL for the HLS broadcast.
broadcastUrls.rtmp: RTMPStream[];
An array of RTMP streams.
createdAt: number;
The time the broadcast started, expressed in milliseconds since the Unix epoch (January 1, 1970, 00:00:00 UTC).
hasAudio: boolean;
Indicates whether the broadcast has audio.
hasVideo: boolean;
Indicates whether the broadcast has video.
id: string;
The unique ID for the broadcast.
optional maxBitrate: number;
The maximum bitrate for the stream.
optional maxDuration: number;
The maximum duration for the broadcast (if one was set), in seconds.
optional multiBroadcasTag: string;
The unique tag for simultaneous broadcasts (if one was set).
optional resolution: Resolution;
The resolution of the broadcast, if set.
sessionId: string;
The Vonage Video session ID associated with the broadcast.
optional settings: object;
An object containing settings for HLS.
optional settings.hls: HlsSettings;
HLS settings.
streamMode: StreamMode;
The stream mode for the broadcast.
updatedAt: number;
The timestamp when the broadcast was last updated, expressed in milliseconds since the Unix epoch.
video/lib/types/Response/BroadcastDetailsResponse.ts:17
type BroadcastOutputs: object;
Interface representing configuration options for different types of broadcast streams (HLS and RTMP).
optional hls: HLSConfig;
Configuration options for HLS streaming.
rtmp: RTMPStream[];
Configuration options for RTMP streaming.
video/lib/types/BroadcastConfig.ts:22
type BroadcastSearchFilter: object;
Interface representing a filter for searching broadcasts.
optional count: number;
The maximum number of items to return.
optional offset: number;
The offset for paginating the results.
optional sessionId: string;
The session ID to filter broadcasts by.
video/lib/types/BroadcastSearchFilter.ts:4
type BroadcastUpdateConfig: object;
Interface representing the configuration for updating a broadcast.
optional addStream: string;
The ID of a stream to add to the broadcast.
broadcastId: string;
The ID of the broadcast to update.
optional hasAudio: boolean;
Whether to include audio in the broadcast.
optional hasVideo: boolean;
Whether to include video in the broadcast.
optional removeStream: string;
The ID of a stream to remove from the broadcast.
video/lib/types/BroadcastUpdateConfig.ts:4
type CaptionOptions: object;
Interface representing options for captions.
optional languageCode: "en-us";
The language code for captions (e.g., "en-us").
optional maxDuration: number;
The maximum duration for captions.
optional partialCaptions: "true" | "false";
Whether to generate partial captions.
optional statusCallbackUrl: string;
The URL for the status callback of captions.
video/lib/types/CaptionOptions.ts:4
type CaptionStatusResponse: object;
Represents a response containing the status of captions for a live streaming broadcast.
applicationId: string;
The Vonage Application UUID.
captionId: string;
The unique ID for the caption.
createdAt: number;
The time when the caption was created, expressed in milliseconds since the Unix epoch (January 1, 1970, 00:00:00 UTC).
duration: number;
The duration of the caption, in seconds.
languageCode: "en-us";
The language code of the captions (e.g., "en-us" for English, US).
provider: "aws-transcribe";
The caption provider (e.g., "aws-transcribe").
optional reason: string;
An optional reason for the caption status.
sessionId: string;
The Vonage Video session ID associated with the broadcast.
status: CaptionStatus;
The status of the captions.
updatedAt: number;
The timestamp when the caption was last updated, expressed in milliseconds since the Unix epoch.
video/lib/types/Response/CaptionStatusResponse.ts:6
type ClientTokenClaims: object;
Interface representing claims for a client token.
acl: object;
Access control list (ACL) for paths.
acl.paths: object;
Paths and associated objects in the ACL.
[key
: string
]: object
optional connection_data: string;
Connection data associated with the token (optional).
optional data: string;
Additional data for the token (optional).
optional exp: number;
The expiration time of the token (optional).
initial_layout_class_list: string;
The initial layout class list.
role: string;
The role of the token.
scope: string;
The scope of the token.
session_id: string;
The session ID associated with the token.
sub: string;
The subject of the token.
video/lib/types/ClientTokenClaims.ts:4
type ClientTokenOptions: object;
Interface representing options for generating a client token.
optional data: string;
Additional data for the client token (optional).
optional expireTime: number;
The expiration time of the client token in seconds (optional).
optional initialLayoutClassList: string[];
An array of initial layout class list for the client token (optional).
optional role: string;
The role associated with the client token (optional).
video/lib/types/ClientTokenOptions.ts:4
type CreateSessionResponse: object;
Represents a response containing the details of a created session.
create_dt: string;
The creation date and time of the session in string format.
media_server_url: string;
The URL of the media server associated with the session.
project_id: string;
The project ID associated with the session.
session_id: string;
The unique session ID.
video/lib/types/Response/CreateSessionResponse.ts:4
type EnableCaptionResponse: object;
Represents a response indicating the ID of the enabled caption.
captionsId: string;
The unique ID of the enabled caption.
video/lib/types/Response/EnableCaptionResponse.ts:4
type ExperienceComposerListFilter: object;
Interface representing filters for listing Experience Composer items.
optional count: number;
The maximum number of items to retrieve (optional).
optional offset: number;
The offset for paginating through the list (optional).
video/lib/types/ExperienceComposerListFilter.ts:4
type ExperienceComposerOptions: object;
Interface representing options for creating an Experience Composer.
optional maxDuration: number;
The maximum duration for the Experience Composer (optional).
optional properties: object;
Optional properties for the Experience Composer.
optional properties.name: string;
The name of the Experience Composer.
optional resolution: ExperienceComposerResolution;
The resolution of the Experience Composer (optional).
optional statusCallbackUrl: string;
The callback URL for status updates (optional).
url: string;
The URL of the Experience Composer.
video/lib/types/ExperienceComposerOptions.ts:6
type ExperienceComposerResponse: object;
Represents a response from the Experience Composer.
applicationId: string;
The application ID associated with the response.
createdAt: number;
The timestamp when the response was created (milliseconds since the Unix epoch).
id: string;
The unique ID of the response.
optional reason: string;
An optional reason for the status, if available.
resolution: ExperienceComposerResolution;
The resolution used by the Experience Composer.
sessionId: string;
The session ID associated with the response.
status: "starting" | "started" | "stopped" | "failed";
The status of the response, which can be one of: "starting", "started", "stopped", "failed".
streamId: string;
The stream ID associated with the response.
updatedAt: number;
The timestamp when the response was last updated (milliseconds since the Unix epoch).
url: string;
The URL associated with the response.
video/lib/types/Response/ExperienceComposerResponse.ts:6
type HLSConfig: object;
Interface representing configuration options for HLS streaming.
optional dvr: boolean;
Whether to enable DVR functionality (rewinding, pausing, and resuming) in players that support it.
optional lowLatency: boolean;
Whether to enable low-latency mode for the HLS stream.
video/lib/types/BroadcastConfig.ts:7
type HlsSettings: object;
Represents HLS settings for a live streaming broadcast.
optional lowLatency: boolean;
Whether to enable low-latency mode for the HLS stream.
video/lib/types/Response/BroadcastDetailsResponse.ts:7
type InitiateSIPCallRequest: SIPCallOptions & object;
Represents the request to initiate a SIP call with additional session information.
sessionId: string;
The session ID of the Vonage Video session to associate with the SIP call.
video/lib/types/Request/InitiateSIPCallRequest.ts:6
type MultiArchiveResponse: object;
Represents a response containing multiple archive items.
count: number;
The count of archive items in the response.
items: SingleArchiveResponse[];
An array of SingleArchiveResponse objects representing individual archive items.
video/lib/types/Response/MultiArchiveResponse.ts:6
type MultiBroadcastResponse: object;
Represents a response containing multiple broadcast details items.
count: number;
The count of broadcast details items in the response.
items: BroadcastDetailsResponse[];
An array of BroadcastDetailsResponse objects representing individual broadcast details items.
video/lib/types/Response/MultiBroadcastResponse.ts:6
type MultiExperienceComposerResponse: object;
Represents a response containing multiple ExperienceComposerResponse items.
count: number;
The count of ExperienceComposerResponse items in the response.
items: ExperienceComposerResponse[];
An array of ExperienceComposerResponse objects representing individual items.
video/lib/types/Response/MultiExperienceComposerResponse.ts:6
type MultiStreamLayoutResponse: object;
Represents a response containing multiple SingleStreamLayoutResponse items.
count: number;
The count of SingleStreamLayoutResponse items in the response.
items: SingleStreamLayoutResponse[];
An array of SingleStreamLayoutResponse objects representing individual items.
video/lib/types/Response/MultiStreamLayoutResponse.ts:6
type ProjectDetailsResponse: object;
Represents the details of a project.
createdAt: number;
The timestamp when the project was created, expressed in milliseconds since the Unix epoch.
environment: string;
The environment of the project.
id: string;
The unique identifier of the project.
name: string;
The name of the project.
secret: string;
The secret associated with the project.
status: string;
The status of the project.
video/lib/types/Response/ProjectDetailsResponse.ts:4
type RTMPStream: object;
Interface representing an RTMP stream configuration.
optional id: string;
Optional unique identifier for the RTMP stream.
serverUrl: string;
The RTMP server URL to which the stream will be sent.
streamName: string;
The name of the stream on the RTMP server.
video/lib/types/RTMPStream.ts:4
type Session: object;
Interface representing a session configuration.
archiveMode: string;
The archive mode for the session (e.g., "MANUAL" or "ALWAYS").
location: string;
The location of the session.
mediaMode: string;
The media mode for the session (e.g., "ROUTED" or "RELAYED").
sessionId: string;
The unique identifier for the session.
type Signal: object;
Represents a signal containing type and data properties.
data: string;
The data associated with the signal, which can be any string data related to the signal.
type: string;
The type of the signal, which can be a custom string identifying the signal type.
type SingleArchiveResponse: object;
Represents the details of a single archive.
createdAt: number;
The timestamp when the archive was created, expressed in milliseconds since the Unix epoch.
duration: number;
The duration of the archive in seconds.
hasAudio: boolean;
Indicates whether the archive has audio.
hasVideo: boolean;
Indicates whether the archive has video.
id: string;
The unique identifier of the archive.
name: string;
The name of the archive.
outputMode: string;
The output mode of the archive.
projectId: string;
The unique identifier of the project to which the archive belongs.
reason: string;
The reason for the archive status.
resolution: string;
The resolution of the archive.
sessionId: string;
The unique identifier of the session associated with the archive.
size: number;
The size of the archive in bytes.
status: string;
The status of the archive.
streamMode: string;
The stream mode of the archive.
optional streams: string[];
An array of stream identifiers associated with the archive.
optional url: string;
The URL of the archive.
video/lib/types/Response/SingleArchiveResponse.ts:4
type SingleStreamLayoutResponse: object;
Represents the details of a single stream layout.
id: string;
The unique identifier of the stream layout.
layoutClassList: string[];
An array of CSS class names associated with the layout.
name: string;
The name of the stream layout.
videoType: string;
The type of video associated with the stream layout.
video/lib/types/Response/SingleStreamLayoutResponse.ts:4
type SIPCallOptions: object;
Interface representing options for initiating a SIP call.
sip: SIPCallSIPConfig;
Configuration options for the SIP call.
token: string;
The authentication token for the SIP call.
video/lib/types/SIPCallOptions.ts:56
type SIPCallResponse: object;
Represents the response for a SIP call initiation.
connectionId: string;
The connection identifier associated with the SIP call.
id: string;
The unique identifier of the SIP call.
streamId: string;
The stream identifier associated with the SIP call.
video/lib/types/Response/SIPCallResponse.ts:4
type SIPCallSIPConfig: object;
Configuration options for a SIP call.
optional auth: object;
Authentication credentials for the SIP call.
auth.password: string;
The password for SIP authentication.
auth.username: string;
The username for SIP authentication.
optional from: string;
The optional "from" field for the SIP call.
optional headers: object;
Custom headers to be included in the SIP call.
[key
: string
]: string
optional observeForceMute: boolean;
Indicates whether to observe and force mute for the SIP call.
optional secure: boolean;
Indicates whether the SIP call should be secure.
uri: string;
The SIP URI to initiate the call.
optional video: boolean;
Indicates whether video is enabled for the SIP call.
video/lib/types/SIPCallOptions.ts:4
type StreamClassList: object;
Represents a stream with associated layout class list.
id: string;
The ID of the stream.
layoutClassList: string[];
An array of layout class names associated with the stream.
video/lib/types/StreamClassList.ts:4
type VideoClassParameters: AuthParams & VetchOptions & object;
Parameters required to initialize the Video class.
applicationId: string;
The unique identifier for the application.
optional auth: AuthInterface;
Optional authentication interface to use for custom authentication.
privateKey: string;
The private key used for authentication.
video/lib/parameters/VideoClassParameters.ts:8
type VideoResponse<T>: VetchResponse<T>;
Represents a video response that wraps a Vetch response.
• T
video/lib/types/VideoResponse.ts:6
type WebSocketConfig: object;
Configuration options for establishing a WebSocket connection.
optional audioRate: AudioRate;
The audio rate to be used for the WebSocket connection.
optional headers: object;
Optional headers to include in the WebSocket request.
[key
: string
]: string
optional streams: string[];
An array of stream IDs to associate with the WebSocket connection.
uri: string;
The URI to connect to the WebSocket server.
video/lib/types/WebSocketConfig.ts:6
type WebSocketConnectResponse: object;
Represents the response for a WebSocket connection.
connectionId: string;
The connection identifier associated with the WebSocket connection.
id: string;
The unique identifier of the WebSocket connection.