Providing RTSP access to an external system¶
An external system needs access to camera video and a separate viewing token. A Watcher shared access token is bound to a camera and defines permitted actions. These tokens are managed through API v3.
The RTSP connection is established with the streamer serving the video, so the external system needs network access to its RTSP port. The Watcher web interface address behind an HTTPS proxy does not itself provide this access. Check RTSP support and the address format for the installed watcher-streamer.
Procedure¶
First add the camera to Watcher and check live video. Take the camera name from the name field in the API response. Sign in as a Watcher administrator and obtain an Admin API token following the authentication instructions. To create a viewing token, send:
POST /watcher/admin-api/v3/shares
Authorization: Bearer <admin_token>
Content-Type: application/json
{
"name": "external-system-live",
"media": "entrance-example",
"permissions": [{"live":true,"dvr":false,"ptz":false,"export":false}]
}
Save key from the response. It grants access to the specified camera. Set permissions explicitly: omitted viewing permissions may be treated as allowed. Create a separate token for each external system so it can be revoked independently.
Tokens are also available in the camera sharing section; see embedding a camera on a website.
Pass the token in the token parameter of the playback address. For an RTSP output addressed by stream name, the address has this form:
rtsp://streamer.example.com:554/entrance-example?token=<key>
Use the actual address and port of your RTSP output. The token recipient can use the granted access without a user account; protect the address as a secret.
Consistent access across a cluster¶
Do not replace the verified address with an arbitrary streamer. Access through different streamers depends on video delivery and routing configuration in your installation. Check the external system address after changing camera placement and after failure of the serving streamer.
Store the camera identifier separately from the streamer address in the integration. This lets you update the connection address while retaining the association with the same camera.
Archive playback¶
The camera must have recordings and the token must have dvr: true permission to read the archive. The export permission applies to exporting the archive to a file and is set separately.
The dvr permission alone does not determine the playback protocol. Check the archive request format and RTSP support for that request on the installed watcher-streamer. After configuration, verify that the external system can open a recorded interval and is denied access beyond its permissions.
Multiplexing access¶
Connect external consumers to Watcher server-side video delivery so each consumer does not open its own connection directly to the camera. The number of watcher-streamer connections to the camera depends on the configured sources, including the main stream and substream.
Revoking access¶
Use an account with camera management rights in the Organization to which the token belongs. To revoke it, send:
DELETE /watcher/admin-api/v3/shares/<key>
Authorization: Bearer <admin_token>
A successful response is 204. Then check a new connection from the external system: it must be rejected. Check existing connections separately; deleting a token does not establish that all media connections have immediately closed.