API Specification#
The VST Web Streaming library encapsulates the complexities of WebRTC, WebRTC Signaling and VST APIs to provide easy to use single shot APIs to developers to perform WebRTC Streaming.
APIs#
Updating lib configuration#
streamManger.updateConfig ({
inboundStreamVideoElementId: string,
outboundStreamVideoElementId?: string,
connectionId?: string,
queryParams?: string,
enableWebsocketPing?: boolean,
websocketPingInterval?: number,
vstWebsocketEndpoint: string,
enableLogs?: boolean,
enableMicrophone?: boolean,
enableCamera?: boolean,
websocketTimeoutMS?: number,
streamType: StreamType,
enableDummyUDPCall: boolean,
sendCustomWebsocketMessage?: (msg: string) => boolean,
firstFrameReceivedCallback?: () => void,
errorCallback?: () => void,
successCallback?: () => void,
closeCallback?: () => void,
});
Key Name |
Description |
Optional/Mandatory |
Default Value |
inboundStreamVideoElementId |
Video Element ID where inbound stream will be displayed |
Mandatory |
undefined |
outboundStreamVideoElementId |
Video Element ID where webcam stream will be displayed |
Optional |
undefined |
connectionId |
The connection ID for the WebSocket connection |
Optional |
random UUID |
queryParams |
Query parameters to pass with WebSocket Connection |
Optional |
empty string |
enableWebsocketPing |
Enable WebSocket Ping so that connection is not dropped due to inactivity |
Optional |
true |
websocketPingInterval |
Change WebSocket Ping message Interval |
Optional |
2000 |
vstWebsocketEndpoint |
VST WebSocket Endpoint. This typically ends with /vms/ws |
Mandatory |
undefined |
enableLogs |
Enable the library logs for debug purpose |
Optional |
true |
enableMicrophone |
Enable Microphone for outbound stream |
Optional |
true |
enableCamera |
Enable Camera for outbound stream |
Optional |
true |
websocketTimeoutMS |
Websocket Timeout |
Mandatory |
5000 |
streamType |
Supported VST Stream types are ‘live’, ‘replay’ and ‘streambridge’ |
Mandatory |
streambridge |
enableDummyUDPCall |
Debug purpose only. If enabled a dummy UDP stream will be started by VST for inbound stream |
Mandatory |
false |
sendCustomWebsocketMessage |
Send any custom message to VST |
Optional |
() => {} |
firstFrameReceivedCallback |
Callback will be triggered when first frame is received by the Video Element |
Optional |
() => {} |
errorCallback |
Callback will be triggered if any errors occurs during streaming or during connection establishment |
Optional |
() => {} |
successCallback |
Callback will be triggered if streaming is successful |
Optional |
() => {} |
closeCallback |
Callback will be triggered when connection is closed inside the lib and cleanup is done |
Optional |
() => {} |
Starting the stream with stream configuration#
streamManger.startStreaming({
streamId?: string,
startTime?: string,
endTime?: string,
options: {
rtptransport: string,
timeout: number,
quality: string,
overlay?: {
objectId?: number[],
color?: string,
thickness?: number,
debug?: boolean,
needBbox?: boolean,
needTripwire?: boolean,
needRoi?: boolean,
}
}
});
Key Name |
Description |
Optional/Mandatory |
Default Value |
streamId |
The stream ID of the sensor stream that will be streamed in the video player |
Optional |
undefined |
startTime |
The start time in UTC format. This is required for replay streams |
Optional |
undefined |
endTime |
The end time in UTC format. This is required for replay streams |
Optional |
undefined |
options |
The options for stream. Options include features like enabling overlay, bounding boxes, quality of stream etc., |
Optional |
undefined |
rtptransport |
WebRTC Specific settings. Keep default value |
Mandatory |
udp |
timeout |
WebRTC Specific settings. Keep default value |
Mandatory |
60 |
quality |
WebRTC Specific settings. The streaming quality can be controlled by using this field. The allowed values are ‘auto’, ‘low’, ‘medium’, ‘high’ and ‘pass-through’ |
Mandator |
auto |
overlay |
The overlay related options like color of overlay, thickness etc. |
Optional |
undefined |
objectId |
The filter for object IDs for overlay. Array of objectIds is allowed as filter |
Optional |
undefined |
color |
The color of overlay |
Optional |
undefined |
thickness |
The thickness of overlay or bounding boxes |
Optional |
undefined |
debug |
Enable debug overlay |
Optional |
undefined |
needBbox |
Enable bounding boxes |
Optional |
undefined |
needTripwire |
Enable tripwire overlay |
Optional |
undefined |
needRoi |
Enable ROI overlay |
Optional |
undefined |
Stopping the stream#
streamManger.stopStreaming();
Getting the peer connection objects#
const inboundObject = streamManger.getInboundPeerConnectionObject();
const outboundObject = streamManger.getOutboundPeerConnectionObject();
Getting Peer IDs#
const inboundPeerId = streamManger.getInboundStreamPeerId();
const outboundPeerId = streamManger.getOutboundStreamPeerId();
Send custom WebSocket message#
const message = "Hello";
const isSuccess = streamManger.sendCustomWebsocketMessage(message);
if (isSucess) console.log("Success");
Get Stream Configuration#
const streamConfiguration = streamManger.getStreamConfig();
Get Lib configuration#
const libConfiguration = streamManger.getConfig();
Supported use-cases#
Tokkio Streaming#
Inbound Stream
Tokkio inbound stream use-case. The library supports inbound video streaming for Tokkio use-case. This is typically used to stream digital human avatars.
Outbound Stream
Tokkio outbound stream use-case. The lib supports outbound video streaming. Either the webcam or the microphone or both can be recorded and sent to VST via outbound stream. In Tokkio use-case the outbound stream works in conjunction with inbound stream.
Examples#
The following sections show minimal working examples.
Tokkio Streaming#
Inbound Stream Only
const streamManger = new StreamManager();
streamManger.updateConfig({
inboundStreamVideoElementId: 'unqiue-video-element-id',
connectionId: 'unique-uuid',
enableWebsocketPing: true,
vstWebsocketEndpoint: 'ws://10.41.25.11:30000/vms/ws',
enableLogs: false,
errorCallback: () => {console.log('Error Callback')},
successCallback: () => {console.log('Success Callback')},
});
streamManger.startStreaming();
Outbound & Inbound Stream
const streamManger = new StreamManager();
streamManger.updateConfig({
inboundStreamVideoElementId: 'unqiue-video-element-id',
connectionId: 'unique-uuid',
enableWebsocketPing: true,
vstWebsocketEndpoint: 'ws://10.41.25.11:30000/vms/ws',
enableLogs: false,
enableMicrophone: true,
enableCamera: true,
errorCallback: () => {console.log('Error Callback')},
successCallback: () => {console.log('Success Callback')},
});
streamManger.startStreaming();