Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This article describes how the VXG Cloud API relates to the built-in SDK functionality. You can use the VXG Cloud Agent documentation to build a simple application that contains callback function stubs. You can find the full source code of the Embedded SDK published on the GitHub

https://github.com/VideoExpertsGroup/VXG.Embedded.SDK

The documentation can be found in the PDF file in the root folder.

We recommend starting with a minimal app and check checking video streaming using the VXG Cloud. You can use the documentation to build the minimal application that contains callback function stubs. In the next stepsteps, you you’ll need to implement all the callback functions and adapt this source code for your awesome solutionusing your camera functionality.

The integration process includes the following steps:

  1. Build

...

  1. a minimal application and check video streaming from a

...

  1. camera to VXG Cloud

  2. Camera capabilities

  3. Video streaming

  4. Integration with the settings API

  5. Integrating PTZ commands

  6. Integration of motion and sound events

  7. Integration of the backward audio channel

Minimal requirements

Below are the minimal requirements for the camera to run the cloud agent based on Embedded SDK:

  • gcc: >= 4.8.1

  • RAM: 30 Mb per channel

  • Flash memory: 12 Mb

1. Build an application and check video streaming from a local IP camera to VXG Cloud

VXG Cloud Agent documentation describes how to build samples. After successful building and installation, you can find the compiled application in the folder: install/bin. 

Before running the application you should go to the VXG dashboard and create a new camera and get a VXG an access token:1.1 Go to Video Management and click Add New Camera:

...

1.2 Select Cloud Camera and click Next:

...

1.3 Enter the camera name, set up recording and the timezone, and click Next:

...

1.4 Now the camera is created, please go to the Settings tab:

...

1.5 Scroll down to find the Streaming access token:

...

 

...

You can also find it in the Integration section:

...

Or you can use V3 Admin API to create a new camera and generate an access token:

https://web.skyvr.videoexpertsgroup.com/docs/v3.html#/channels/post_channels_

After obtaining the access token, you can run the following command and watch the video in the VXG dashboard:

...

error Cloud reported a problem: Cam 234432 '_update_video_stream_caps' exception IndexError: list index out of range at camera.py:1475
warning get_stream_config not implemented
warning set_steam_by_event not implemented
warning Failed to configure stream {} for pre/post recording.

2. Camera capabilities

The VXG Cloud requests all camera capabilities and current camera settings when the camera connects to the VXG Cloud for the first time or the app version is changed, so the camera app should provide camera capabilities to VXG Cloud. In order to do this, the following commands in your callbacks should be implemented.

Here is a list of callbacks classes and functions that must be implemented using your platform capabilities:   

Callback class

Function name

Description

vxg::cloud::agent::media::stream

get_supported_stream

get_stream_caps

get_stream_config

caps_video_object

caps_audio_object

motion_detection_caps

vxg::cloud::agent::callback

on_get_cam_video_config

on_get_cam_audio_config

on_get_ptz_config

on_get_osd_config

on_get_wifi_config

on_get_motion_detection_
config

on_set_cam_events_config

on_get_timezone

on_get_memorycard_info

audio_config

video_config

ptz_config

osd_config

wifi_config

motion_detection_config

memorycard_info_object

3. Video streaming

The camera agent application broadcasts the video stream to VXG Cloud and uploads images and video files to the VXG storage directly. VXG Cloud sends "start" and "stop" commands to the camera, and the VXG agent starts or stops streaming.

The agent::media::stream class is an abstract class for media streams, the library provides basic media::rtsp_stream implementation which retransmits RTSP source stream to the endpoint of the VXG Cloud, all settings-related callbacks are stubbed. A developer should implement their own class derived from the media::stream with their own media::Streamer::ISource implementation, or implement their own class derived from the media::rtsp_stream but with callbacks implemented. 

4. Integration with the settings API

The list below shows the relationship between the VXG Cloud API and the callback functions in the VXG agent library that the application should handle: 

Description

API

Callback class

Parameters

Returns basic video settings and capabilities

GET
/cameras/{CAMID}/video/

on_get_cam_video_config

vertical flip

horizontal flip

tdn (true day/night)

IR light for night conditions

brightness

contrast

saturation

sharpness

noise reduce types

level of noise reduce

white balance types

power line frequency

Changes basic video settings of the camera

PUT
/cameras/{CAMID}/video/

on_set_cam_video_config

vertical flip

horizontal flip

tdn

IR light for night conditions

brightness

contrast

saturation

sharpness

noise reduce types

level of noise reduce

white balance types

power line frequency

Returns basic audio settings and capabilities

GET
/cameras/{CAMID}/audio/

on_get_cam_audio_config

microphone gain

microphone mute

speaker volume

mute speaker

echo cancellation

Changes basic audio settings of the camera

PUT
/cameras/{CAMID}/audio/

on_set_cam_audio_config

microphone gain

microphone mute

speaker volume

mute speaker

echo cancellation

Returns OSD settings and capabilities

GET
/cameras/{CAMID}/osd/

on_get_osd_config

static content of OSD

enable/disable time part of OSD

enable/disable date part of OSD

one of predefined values from caps

one of predefined font sizes from caps

name of one of predefined font colors from

name of one of predefined background colors

enable/disable OSD background transparency

one of predefined positions from caps

Changes OSD settings of the camera

PUT
/cameras/{CAMID}/osd/

on_set_osd_config

static content of OSD

enable/disable time part of OSD

enable/disable date part of OSD

one of predefined values from caps

one of predefined font sizes from caps

name of one of predefined font colors from

name of one of predefined background colors

enable/disable OSD background transparency

one of predefined positions from caps


Returns basic settings and capabilities of motion detection

GET
/cameras/{CAMID}/
motion_detection/

on_get_motion_detection
_config

rows - number of detection cells by Y

columns - number of detection cells by X

List of motion regions


Changes motion detection settings

PUT
/cameras/{CAMID}/
motion_detection/

on_set_motion_detection
_config

rows - number of detection cells by Y

columns - number of detection cells by X

List of motion regions

5. Integrating PTZ commands

The developer should implement the following callback functions if the camera supports PTZ controls:

...

All supported PTZ actions are described in the enum ptz_action. 

6. Integration of motion and sound events

The developer should implement their own class based on the event stream class and whether the camera supports any events. The number of supported events is specified in the vxg::cloud::agent::proto::event_type enumeration. It is recommended to prepare the event generating module in the vxg::cloud::agent::event_stream::start function and clean or stop this module in the vxg::cloud::agent::event_stream::stop function.

...

The video downloading must be done in the callback function proto::video_clip_info record_export. The video is uploaded to the storage directly. It is best to upload videos a few seconds before the event and a few seconds after the event.

7. Integration of the backward audio channel

If any client initiates a backward audio session using the VXG Cloud, the VXG agent library calls the vxg::cloud::agent::callback::on_start_backward_audio callback function. The camera app gets the RTMP or RTMP URL in this callback.

...