ShowVideo
This Activity is used to display a camera in WinGuard.
Note: That it is only used when the camera shall be shown on an internal monitor of WinGuard. When the camera should be shown on an external monitor, use the ShowVideoExternal Activity (supports archive) or the Video.In.Device/Video.Out.Device Functionalities (no archive) instead.
WinGuard does not support the combination of ShowVideo and Video.In.Device in the same Object type. To implement a Camera Object with support for both local/digital and external/analog display, use the combination of ShowVideo and ShowVideoExternal instead.
See also VideoCommunication for better conceptual overview.
Objects
| Role | Prop | Type | Description |
|---|---|---|---|
| Source | SourceType | int | 0: Invalid 1: Object 2: File |
| Source | string/object | If SourceType == Object: URL of the Object (same as member URL; value type string).If SourceType == File: Resource definition of the file (value type object). |
|
| Destination | HWND | int | Window handle to render video to. |
Props
The following Properties need to be updated by the Extension. The Properties should always represent the current state of the video. An AOP server (application), like WinGuard, reads these Properties and updates itself accordingly.
For example, the adapter receives the command to play the video at speed 8, but its hardware only allows a speed of 2, then the adapter can set the speed to 2 or ignore the request. The AOP server (application) then reads the result and update its UI or other systems.
| Id | Type | Description |
|---|---|---|
| Time | time | (optional) Current archive time. This Property is set when the video is in archive mode, in live mode it isn’t. |
| Speed | double | (optional) Current playback speed in the archive. This Property is only set when the video is in archive mode. Only the following values are allowed: -8, -4, -2, -1, -0.5, -0.25, -0.125, 0, 0.125, 0.25, 0.5, 1, 2, 4, 8. When a different value is set, the next lower valid value is used by WinGuard. |
| Stream | string | (optional) Stream ID of the currently shown stream. If not set the default stream is shown. |
| StreamList | string[] | (optional) List of available stream IDs |
| StartTime | time | (optional) Start time of the file |
| EndTime | time | (optional) End time of the file |
| Brightness | double | (optional) Brightness value of the video image: [0, 100] |
| Contrast | double | (optional) Contrast value of the video image: [0, 100] |
| Saturation | double | (optional) Saturation value of the video image: [0, 100] |
Streams
The ShowVideo Activity supports choosing between different source streams. The stream list indicates the available streams. The information about the streams can be provided during the automatic data supply using the Property Streams:
| Id | Type | Description |
|---|---|---|
| Id | string | Identifier of the stream |
| Name | string | Display name of the stream |
| Mode | string[] | (optional) Defines when the stream should be selectable. Values are Live, Archive or Analysis.The combination of values also define a group if automatic resolution bases stream selection is used. |
| Width | int | (optional) If set, defines the maximal target window width the stream could be selected in the automatic stream selection. |
| Height | int | (optional) If set, defines the maximal target window height the stream could be selected in the automatic stream selection. |
To configure this data, the Object must contain a Property with id="Streams" and kind="cam_stream".
<Object id="Camera">
<Property id="Streams" type="object[]" kind="cam_stream" />
</Object>
Alternatively, if something needs to be defined individually, all required Properties must be fully specified. They are nested within the outer Streams Property.
<Object id="Camera">
<Property id="Streams" type="object[]">
<Property id="Id" type="string" />
<Property id="Name" type="string" kind="localize" />
<Property id="Mode" type="string[]" >
<Option value="Live" />
<Option value="Archive" />
<Option value="Analysis" />
</Property>
<Property id="Width" type="int" />
<Property id="Height" type="int" />
</Property>
</Object>
Operations
All changes on a running video are requested by the different Operations. After execution, the Extension must always update the Properties of the Activity.
Play
Operation to seek to requested archive time, to change playback speed or to change stream.
| Property | Type | Description |
|---|---|---|
| Time | time | (optional) The time of the video should be shown in archive mode. |
| Speed | double | (optional) The speed at which the video should be played. Use “0” to pause the video. |
| Stream | string | (optional) ID of the stream that should be played. |
Although all Properties are optional, only certain combinations of Properties are valid. For a better overview, the following table shows which parameters are used in which situation.
| Seek a time | Change speed | Change stream | |
|---|---|---|---|
| speed | can be set additionally | set | not set |
| time | Time at which the video is to be shown | not set | not set |
| stream | can be set additionally | not set | set |
When the speed is set additionally, the video should be played at the given speed. When the stream is set additionally, the video should be shown in the given stream.
When showing a live stream, the Play Operation is used to request a switch into archive mode. The initial Play Operation for the switch is a seek that includes at least a time and speed.
GoLive
Operation to show the current live video.
| Property | Type | Description |
|---|---|---|
| Stream | string | (optional) ID of the stream that should be shown. |
Step
Operation to go one step further or backwards in the video. After the execution of this Operation, the video should be paused by default. To do so, the speed Property of the Activity needs to be set to 0.
| Property | Type | Description |
|---|---|---|
| Direction | string | Available options: “Forward”, “Backward” |
| Frames | int | (optional) Defines the size of the step in frames. |
| IntervalMs | int | (optional) Defines the duration of a frame in milliseconds. |
SetBrightness
Operation to set the brightness value of the video image. The Operation is triggered by changing UI brightness control of the video manager.
| Property | Type | Description |
|---|---|---|
| Brightness | double | Brightness value in the range of [0, 100] |
SetContrast
Operation to set the contrast value of the video image. The Operation is triggered by changing UI contrast control of the video manager.
| Property | Type | Description |
|---|---|---|
| Contrast | double | Contrast value in the range of [0, 100] |
SetSaturation
Operation to set the saturation value of the video image. The Operation is triggered by changing UI saturation control of the video manager.
| Property | Type | Description |
|---|---|---|
| Saturation | double | Saturation value in the range of [0, 100] |
ExportImage
Operation to export a snapshot at a specified timestamp of the video.
To enable this Operation, the App Settings App.CanExportImages and App.ExportImageExtensions have to be set in the Module XML.
Tip: To determine if a received ExportImage Operation was triggered for live video or archive video, check the Activity URL that is sent along with the Operation. The adapter knows whether the Activity is in live or archive mode (e.g., by checking the Time Property).
Properties
| Name | Type | Description |
|---|---|---|
| Format | string | The target file format |
| Time | time | The timestamp of the image to export |
Result
The ImageData can be returned directly or via out-of-band transmission.
| Name | Type | Description |
|---|---|---|
| ImageData | data/object | The image data as a byte array; or a resource definition for an Operation-bound ‘put’ resource. |
| Time | time | (optional) The actual time the image was taken, if available. |
ExportVideo
Operation to export a video recording.
To enable this Operation, the App Settings App.CanExportVideos and App.ExportVideoExtensions have to be set in the Module XML.
Properties
| Name | Type | Description |
|---|---|---|
| Format | string | The target file format |
| StartTime | time | The start time of the recording to export |
| EndTime | time | The end time of the recording to export |
| Stream | string | (optional) The stream ID from which the video should be exported |
Result
The VideoData can be returned directly or via out-of-band transmission.
| Name | Type | Description |
|---|---|---|
| VideoData | data/object | The video data as a byte array; or a resource definition for an Operation-bound ‘put’ resource. |
Module XML example
<Settings>
<Setting id="App.CanExportImages" type="bool" value="1"/>
<Setting id="App.CanExportVideos" type="bool" value="1"/>
<Setting id="App.ExportImageExtensions" type="string[]" value="["png"]">
<Option id="png"/>
</Setting>
<Setting id="App.ExportVideoExtensions" type="string[]" value="["mp4"]">
<Option id="mp4"/>
</Setting>
</Settings>
<Objects>
<!-- Camera -->
<Object id="Camera">
<Property id="CameraName" type="string" address="1" />
<Property id="Streams" type="object[]" kind="cam_stream" />
<Activity id="myshowvideo" role="Source" />
<Event id="Alarm" reset="1" />
<Event id="Fault"/>
</Object>
</Objects>
<Activities>
<!-- Show video -->
<Activity id="myshowvideo" type="ShowVideo">
<Property id="Time" type="time" optional="1" />
<Property id="Speed" type="double" optional="1" />
<Property id="Stream" type="string" optional="1" />
<Property id="StartTime" type="time" optional="1" />
<Property id="EndTime" type="time" optional="1" />
<Property id="StreamList" type="string" optional="1" />
<ObjectRole id="Source">
<Property id="SourceType" type="int">
<Option id="Invalid" value="0" />
<Option id="Object" value="1" />
<Option id="File" value="2" />
</Property>
<Property id="Source" type="value" optional="1" />
</ObjectRole>
<ObjectRole id="Destination">
<Property id="HWND" type="int" />
</ObjectRole>
<Operation id="Play">
<Property id="Time" type="time" optional="1" />
<Property id="Speed" type="double" optional="1" />
<Property id="Stream" type="string" optional="1" />
</Operation>
<Operation id="GoLive" available="Time!=null AND StartTime==null AND EndTime==null">
<Property id="Stream" type="string" optional="1" />
</Operation>
<Operation id="Step">
<Property id="Direction" type="string">
<Option value="Forward" />
<Option value="Backward" />
</Property>
<Property id="Frames" type="int" optional="1" />
<Property id="ms" type="int" optional="1" />
</Operation>
<Operation id="ExportImage">
<Property id="Format" type="string" />
<Property id="Time" type="time" />
</Operation>
<Operation id="ExportVideo">
<Property id="Format" type="string" />
<Property id="StartTime" type="time" />
<Property id="EndTime" type="time" />
<Property id="Stream" type="string" optional="1" />
</Operation>
</Activity>
</Activities>
Workflow
When WinGuard wants to switch on a camera on one of its monitors, it triggers the start of a ShowVideo Activity via activity.Start IPC call.
The initial Activity Properties supplied via activity.Start indicate whether the streaming session should start in live or archive mode.
ShowVideo Activities are never created/ended independently by the adapter.
The streaming session is controlled via ActivityOperations (e.g., Play, Step, GoLive, etc.).
The adapter should update the Activity Properties continuously to reflect its current state.
This Activity is running until the camera is switched off or the corresponding monitor in WinGuard is closed.
This is triggered via activity.End IPC call.