Skip to content
Developers

VORTEX Streaming

This is the documentation for the vortex-streaming web component.
It requires the following props: deviceId, apiToken.

Web Components

are a set of web platform APIs that allow you to create reusable custom elements in web pages and applications.
To learn more about Web Components, you can refer to the MDN Web Components documentation.

Lastest SDK

Released

In Development

DEV The following release is currently under development.

Info: To incorporate the loading icon and other icons within the web component, please download the sprite.svg file provided below and place it in the root directory of your project.

Usage

Reference in header

html
<script defer src="https://portal.vortexcloud.com/vortex-streaming.min.js"></script>

Props

PropTypeDescriptionRequired
deviceIdStringThe ID of the device.Yes
deviceTypeStringThe type of the device.
Possible values: nvrchannel for NVR camera and camera for camera. Defaults to camera if not specified.
No
apiTokenStringThe API token used for authentication.Yes
autoPlayBooleanDetermines if the streaming block should start playing automatically.
For manual playback control, ensure autoPlay is set to false before adding the component to the DOM.
No
mutedBooleanDetermines if the audio of the streaming block should be muted.No
volumeNumberSets the volume level of the streaming block. Accepts values between 0-100.No
apiDomainStringThe API domain name for development purposes, if needed.
DEV
No
supportWebCodecsBooleanEnable WebCodecs-based decoding when supported by the browser.
DEV
No

Events

TypeDescription
playTriggered when the streaming block starts playing.
stopTriggered when the streaming block stops playing.
errorTriggered when an error occurs. The error detail is available on the event.
notifyGeneral notifications from the player (e.g., timestamps or fisheye info).

Methods

NameParametersDescription
playtimestamp: Number (Optional, ms)Starts live (no timestamp) or playback at a specific timestamp (UTC ms).
pausePauses the playback of the streaming content.
resumeResumes the playback of the streaming content.
stopStops the current stream.
forwardseconds: NumberSeeks forward by N seconds. Intended for playback mode.
backwardseconds: NumberSeeks backward by N seconds. Intended for playback mode; allowed in live mode (transitions to playback).
setVolumevolume: Number (0-100)Sets the volume immediately.
muteMutes audio.
unmuteUnmutes audio.
enableDigitalZoomenable: BooleanEnables or disables digital zoom feature.
setDewarpTypetype: StringSets the dewarp type. Possible values: '1O' (off), '1P', '2P', '1R', '2R', '1R2', '4R'.
setVcaSettingssettings: ObjectConfigures VCA (Video Content Analysis) display settings. See VCA Settings section below.

VCA Settings

The setVcaSettings method accepts an object with the following supported properties:

SettingTypeDescription
showPeopleBoxBooleanShow/hide bounding boxes for detected people.
showVehicleBoxBooleanShow/hide bounding boxes for detected vehicles.
displayPeopleTypeBooleanDisplay people type labels (requires showPeopleBox to be true).
displayNameBooleanDisplay name labels (requires showPeopleBox to be true).
displayVehicleTypeBooleanDisplay vehicle type labels (requires showVehicleBox to be true).

Note: Only the settings listed above are supported. Any other keys will be ignored.

Example

html
<head>
  <script defer src="https://portal.dev.vortexcloud.com/vortex-streaming.min.js"></script>
</head>
<body>
  <vortex-streaming
    api-token="${API_TOKEN}"
    device-id="${DEVICE_ID}"
    auto-play="${AUTO_PLAY}"
    volume="50"
    muted
    support-web-codecs="false"
  ></vortex-streaming>
  <script>
    document.addEventListener('DOMContentLoaded', () => {
      const element = document.querySelector('vortex-streaming');
      // Add event listener
      element.addEventListener('play', () => {
        console.log('streaming started');
      });
      element.addEventListener('error', (e) => {
        console.error('streaming error', e.detail);
      });

      // Liveview will automatically start by default (auto-play is true by default)

      // Set auto-play to false before attaching component to DOM, specify a timestamp in ms, and call the play function to play the playback
      const timestamp = 1697506106288;
      element._instance.exposed.play(timestamp);

      // Playback controls (see Methods section for available playback controls)
      element._instance.exposed.pause();
      element._instance.exposed.resume();

      // Digital Zoom control
      element._instance.exposed.enableDigitalZoom(true);  // Enable
      element._instance.exposed.enableDigitalZoom(false); // Disable

      // Dewarp control
      element._instance.exposed.setDewarpType('1P'); // Enable dewarp with 1P mode
      element._instance.exposed.setDewarpType('1O'); // Disable dewarp

      // VCA control - Enable all VCA features
      element._instance.exposed.setVcaSettings({
        showPeopleBox: true,
        showVehicleBox: true,
        displayPeopleType: true,
        displayVehicleType: true,
      });

      // VCA control - Enable only specific features
      element._instance.exposed.setVcaSettings({
        showPeopleBox: true,
        displayPeopleType: true,
      });

      // VCA control - Disable all VCA features
      element._instance.exposed.setVcaSettings({
        showPeopleBox: false,
        showVehicleBox: false,
        displayPeopleType: false,
        displayVehicleType: false,
      });
    });
  </script>
</body>