Often our customers already have existing front and back-ends and they need to add video functionality (Cloud VMS) to an existing service. The article below describes how this can be done.
Usually, our customer’s service will have at least the following 3 components:
Authentication service.
Back-end service with a database.
Web front-end.
Once authenticated the Web front-end communicates with the back-end service for reading, writing, and processing information.
Adding Cloud VMS usually means implementing the following 3 steps:
Adding VXG Web SDK to the front-end. The Web SDK is an HTML player for playing live and recorded video from VXG Cloud VMS. It includes all common UI controls that can be configured.
Adding VXG non-admin REST API calls to the front-end for calling any functions of the VXG Cloud VMS, for example retrieving a list of images for motion events.
Adding VXG admin REST API calls to the back-end. These calls usually go through a secure server-to-server channel and are used to create or delete channels (add or remove cameras). Once a camera is added, its access token is stored in the back-end database.
Here is an example of the sequence of operations.
The authenticated front-end instructs the back-end to add and a new camera.
The back-end calls the Admin REST API function
POST /channels/
that returns a channel access token that is stored in the back-ends database.The front-end requests the back-end for available channels and receives a list of channel access tokens.
The front-end calls Non-admin REST API functions, for example,
GET /live/image
to retrieve the latest snapshot.The front-end calls the VXG Web SDK function
play()
to playback live or recorded video.
The Admin REST API calls should be authorized with a Cloud Key that can be found on the Integrator’s dashboard. We strongly recommend using Admin API only through a server-to-server secure channel.
The Non-admin REST API calls should be authorized with the Channel Access Token. The Channel Access Token is generated once the back-end creates a new channel (adds a new camera) and stored in the back-end’s database. The Channel Access Token can be invalidated and thus it’s safe to call Non-admin REST API from the front-end.
The Web SDK also uses the Channel Access Token to play video.