Getting started
This document describes Visual Edge Computing Service and explains how to use its APIs.
Spaces, templates, devices, and streams
Space
In Visual Edge Computing Service, a space is a logical collection for managing devices and streams. A space contains the following information:
Space (manages streams, devices, and application templates)
Access type*
RTMP, GB/T 28181
Domain name*
Ingest domain, streaming domain (GB/T 28181 requires only a streaming domain)
Playback type
RTMP, FLV, HLS
AppName
Live (default)
Webhook address
Notifications for stream and device status changes
On-demand stream pulling
Not supported for RTMP spaces. Supported for GB/T 28181 spaces.
Space operations
Create a space.
Select an access type.
Configure a domain name.
NoteA domain name is configured only once during space initialization and cannot be modified later. You must configure it carefully. URL signing is enabled by default. Both ingest and playback URLs are signed. Before you can preview or play back streams, you must configure a canonical name (CNAME) record for the domain name. If you do not configure a CNAME record, RTMP stream ingest will fail. For GB/T 28181, you can add devices, but playback will not work.
Global templates
Templates in Visual Edge Computing Service are global and include the following types:
Global templates (create, attach, detach)
Recording template
Standard recording, on-demand recording, time-shifted recording
Snapshot template
Overwrite snapshots, real-time snapshots (taken at a set frequency), on-demand snapshots
Transcoding template
Each transcoding template corresponds to a group of up to four transcoding specifications with different output bitrates and resolutions.
Notes on template operations
Recording, snapshots, and transcoding are applied at the stream level. For these features to take effect, you must create and attach a template. The template is triggered when a stream is ingested.
You must create a template to use standard recording, time-shifted recording, snapshots, or transcoding. A template is not required for real-time preview.
You can detach templates that you no longer need. After a template is detached, recording, snapshots, and transcoding stop.
If a stream is already active, you must restart the stream to apply new time-shifting and transcoding configurations.
Templates are global. You can attach the same template to multiple spaces. Some templates can also be attached at the stream level. A stream-level template has a higher priority than a space-level template.
Device
Spaces that do not use RTMP for access use the concept of a device. Device information includes the following:
Add device (GB/T 28181 space)
GB/T 28181 ID
Configured by the IPC user. For NVRs or downstream platforms, the configuration is synchronized to Visual Edge Computing Service through the GB/T 28181 protocol.
Device ID
Generated by Visual Edge Computing Service.
Stream ID
Generated by Visual Edge Computing Service.
Stream name
In a GB/T 28181 space, the stream name is the same as the GB/T 28181 ID.
Device status
Online, Offline, Locked (incorrect registration information; correct the information and unlock the device to register again), Unregistered (device added on the server-side but not yet registered through GB/T 28181).
Stream status
Online, Offline
GB/T 28181 device operations
GB/T 28181 registration:
Add device information by calling the Visual Edge Computing Service API
You can configure GB/T 28181 registration on the camera, NVR, or platform.
Obtain device status:
After a device connects successfully, its status is updated in real time. You can manage the device by starting stream pulling, stopping the stream, or using PTZ controls.
Obtain playback URL:
You can use the API to obtain a signed URL for playback.
Control the device:
For an IPC, you can control the device directly after GB/T 28181 registration. For an NVR or platform, you can connect and then use the NVR or platform channel to obtain the IPC status for control and management.
Stream
For RTMP access, the main task is to generate ingest and playback URLs. You can perform operations on the stream, such as disabling or resuming stream ingest.
In an RTMP space, after you configure a domain name and URL signing, you can use a custom URL to ingest a stream. The URL format is `rtmp://{domain name}/{appname}/{streamname}&auth={access token}`. The `domain name` and `appname` are set during space creation. You can customize the `streamname` during stream ingest.
Playback URLs support the RTMP, FLV, and HLS formats.
Supported templates at the space and stream levels
The following tables describe the template types supported at the space and stream levels.
Space level | |||
Recording | Real-time recording: Generates multiple recording file segments at a set frequency. | On-demand recording: You can call the start API to begin recording and the end API to stop. If you do not call the end API, recording continues until the stream disconnects. | |
Snapshot | Real-time snapshot: Takes multiple snapshots at a set frequency. | Overwrite snapshot: Takes snapshots at a set frequency. Each new snapshot overwrites the previous one, so only the latest snapshot is kept. | On-demand snapshot: You can call the API once to generate a single snapshot. |
Time-shifted recording | You can set the number of days for loop recording. | Note: After you apply a time-shifting template, you must restart the stream for the configuration to take effect. | |
Transcoding | A transcoding template can have up to four transcoding rules, which correspond to four transcoded stream outputs. By default, each space supports 10 transcoded stream outputs. If you need more, you can submit a ticket. | Note: After you apply a transcoding template, you must restart the stream for the configuration to take effect. | |
Stream level | |||
Recording | Real-time recording: Generates multiple recording file segments at a set frequency. | On-demand recording: You can call the start API to begin recording and the end API to stop. If you do not call the end API, recording continues until the stream disconnects. | |
Snapshot | Real-time snapshot: Takes multiple snapshots at a set frequency. | Overwrite snapshot: Takes snapshots at a set frequency. Each new snapshot overwrites the previous one, so only the latest snapshot is kept. | On-demand snapshot: You can call the API once to generate a single snapshot. |
Time-shifted recording | You can set the number of days for loop recording. | Note: After you apply a time-shifting template, you must restart the stream for the configuration to take effect. | |
You can create a space. A space is a logical container for your devices and streams, which you can define based on your business needs. Each space uses a unique ingest and streaming domain name set during initialization. GB/T 28181 spaces require only a streaming domain name. RTMP spaces manage only streams.
You can create templates for snapshots, recording, and time-shifting. You can create transcoding templates at the space level.
You can attach a template. After you attach a template to a space, it takes effect when a stream is ingested. You can configure snapshot, recording, and time-shifting templates at the stream level.