The CamSwitcher App is an ACAP application running on your camera. It offers the possibility to switch between up to five AXIS network cameras, including video clips saved on the camera's SD card.
The process of switching between Live Views can be performed manually, automatically via predefined playlists, or programmed via API commands. Simply choose your master audio and generate a single output video stream in real-time.
CamSwitcher App must be installed on a camera with an ARTPEC-6 processor or higher (see compatibility). The rest of the cameras used as additional video and audio sources require at least an ARTPEC-5 chipset with the main H.264 profile (see chipset). You’ll also need a CamStreamer App to stream your video on a streaming platform of your choice.
The port used in HTTP requests is the HTTP port of the camera which is 80 by default. If it is not changed you do not need to specify it.
Read more about API licensing here
Sample API requests to Postman can be downloaded here
Get the current RTSP link of the video stream
The video access expires after 5 min and you can use it only once.
http://IPADDR[:PORT]/local/camswitcher/output_info.cgi
where
IPADDR[:PORT] is an IP address:port of the camera. E.g. 192.168.91.202
Response example:
{
"status": 200,
"message": "OK",
"data": {
"rtsp_url": "rtsp://127.0.0.1:1554/6da0c033531ad459e64cd9847e6c994014f4ef29afe3f46afeab82a222805200",
"ws": "ws://127.0.0.1/local/camswitcher/video",
"ws_initial_message": "{\"type\":\"ALIAS_NAME\", \"data\": \"6da0c033531ad459e64cd9847e6c994014f4ef29afe3f46afeab82a222805200\"}"
}
}
To play video replace the local host IP address with the real IP address of the camera.
Get the list of available playlists
Note that for CamSwitcher App each playable object is considered as a playlist. It could be a camera with audio, a video clip with audio, a playlist that contains more video clips, and cameras with audio.
Example:
http://IPADDR[:PORT]/local/camswitcher/react/local/camswitcher/api/playlists.cgi?action=get
where
IPADDR[:PORT] is an IP address:port of the camera. E.g. 192.168.91.202
Response example:
{ "status": 200, "message": "OK", "data": { "s4776be33-bcca-45a3-912b-e2840c6c06de": { "niceName": "Video_clip", "loop": false, "isFavourite": false, "stream_list": [{ "id": "78b12cf8-4d91-4e2c-a444-92e14543b8be", "timeout": 0, "repeat": 1, "isTimeoutCustom": false, "video": { "clip_name": "s4776be33-bcca-45a3-912b-e2840c6c06de" }, "audio": { "clip_name": "s4776be33-bcca-45a3-912b-e2840c6c06de" } }], "keyboard": {}, "channel": "av" }, "cdb04b0cb-0c7b-4292-aa0f-7920eb73333e": { "niceName": "V5925 - B8A44F009C1F", "loop": false, "isFavourite": false, "stream_list": [{ "id": "dfe22a89-7e8d-40b2-a59c-f25c6226efb0", "timeout": 0, "repeat": 1, "isTimeoutCustom": false, "video": { "stream_name": "cdb04b0cb-0c7b-4292-aa0f-7920eb73333e" }, "audio": { "clip_name": "sd2b03f67-31c7-40b2-99c1-5079dd0dab65" } }], "keyboard": {}, "channel": "av" } } }
Name of the playlist is the first chain placed before niceName parameter. Name of the playlist for camera V5925 is cdb04b0cb-0c7b-4292-aa0f-7920eb73333e.
Camera playlists have always prefix "c" and true playlists have always prefix "p".
Examples:
Start particular playlist
Use playlist name from the previous example of how to get a list of playlists.
Example:
http://IPADDR[:PORT]/local/camswitcher/react/local/camswitcher/api/playlist_switch.cgi?playlist_name=PLAYLISTNAME
where
IPADDR[:PORT] is an IP address:port of the camera. E.g. 192.168.91.202
PLAYLISTNAME is the name of a particular playlist which contains a combination of audio and video, e.g. cdb04b0cb-0c7b-4292-aa0f-7920eb73333e
Get the list of playlists in the queue
Via request bellow, you can list playlist names waiting in the queue to be played.
Example:
http://IPADDR[:PORT]/local/camswitcher/react/local/camswitcher/api/playlist_queue_list.cgi
where
IPADDR[:PORT] is an IP address:port of the camera. E.g. 192.168.91.202
Push a particular playlist to the queue
Push a particular playlist from the current queue.
http://IPADDR[:PORT]/local/camswitcher/react/local/camswitcher/api/playlist_queue_push.cgi?playlist_name=PLAYLISTNAME
where
IPADDR[:PORT] is an IP address:port of the camera. E.g. 192.168.91.202
PLAYLISTNAME is the name of a particular playlist which contains a combination of audio and video, e.g. cdb04b0cb-0c7b-4292-aa0f-7920eb73333e
Play the next playlist from the queue
Play the next playlist from the current queue.
Example:
http://IPADDR[:PORT]/local/camswitcher/react/local/camswitcher/api/playlist_queue_play_next.cgi
where
IPADDR[:PORT] is an IP address:port of the camera. E.g. 192.168.91.202
Clear the playlist queue
Clear the current playlist queue
Example:
http://IPADDR[:PORT]/local/camswitcher/react/local/camswitcher/api/playlist_queue_clear.cgi
Switch playlist immediately
Switch playlist immediately. Same as a sequence: playlist_queue_clear.cgi
, playlist_queue_push.cgi
, playlist_queue_play_next.cgi
Example:
http://IPADDR[:PORT]/local/camswitcher/react/local/camswitcher/api/playlist_switch.cgi?playlist_name=PLAYLISTNAME
where
IPADDR[:PORT] is an IP address:port of the camera. E.g. 192.168.91.202
PLAYLISTNAME is the name of a particular playlist which contains a combination of audio and video, e.g. cdb04b0cb-0c7b-4292-aa0f-7920eb73333e
Get the list of available clips
Reading of available clips can be useful e.g. when you want to switch master audio and need to know the clip name.
http://IPADDR[:PORT]/local/camswitcher/react/local/camswitcher/api/clips.cgi?action=get
where
IPADDR[:PORT] is an IP address:port of the camera. E.g. 192.168.91.202
Change master audio output
Via requests below, you can change the master audio output.
Configuration of master audio:
{
"master_audio": {
"type": "NONE",
"stream_name": "",
"clip_name": ""
}
}
- type (string)
*
- type of master audio (NONE
/SILENCE
/STREAM
/CLIP
) - stream_name (string) - stream identifier for type =
STREAM
- clip_name (string) - clip identifier for type
Example of master audio change to clip:
http://IPADDR[:PORT]/axis-cgi/param.cgi?action=update&camswitcher.masterAudio={"type":"CLIP","clip_name":"CLIPNAME"}
Example of master audio change to stream:
http://IPADDR[:PORT]/axis-cgi/param.cgi?action=update&camswitcher.masterAudio={"type":"STREAM","stream_name":"STREAMNAME"}
Example of master audio change to respect audio of playing source:
http://IPADDR[:PORT]/axis-cgi/param.cgi?action=update&camswitcher.masterAudio={"type":"NONE"}
Example of master audio change to silence:
http://IPADDR[:PORT]/axis-cgi/param.cgi?action=update&camswitcher.masterAudio={"type":"SILENCE"}
Example of how to get currently set master audio:
http://IPADDR[:PORT]/axis-cgi/param.cgi?action=list&group=camswitcher.masterAudio
where
IPADDR[:PORT] is an IP address:port of the camera. E.g. 192.168.91.202
WebSocket API
Over the WebSocket connection, you can receive information about events within the CamSwitcher App and stream availability.
Authorization
Get authorization token for WebSocket API. The token is valid only for 30 seconds or until the first connection.
Request:
http://USER:PASS@IPADDR[:PORT]/local/camswitcher/api/ws_authorization.cgi
where
USER
is a user name. E.g. root
PASS
is a password. E.g. pass
IPADDR[:PORT]
is an IP address:port of the camera. E.g. 192.168.1.5
Response:
{ "status": 200, "message": "YZWG1nBG7HtRc8Owy61P",}
Connection to WebSocket
You must use authorization as the first message. After successful authorization, the initialization data are sent. On authorization error, WebSocket is closed.
Used protocol (Sec-WebSocket-Protocol
) is events
WebSocket address:
wss://IPADDR[:PORT]/local/camswitcher/events
where
IPADDR[:PORT]
is an IP address:port of the camera. E.g. 192.168.1.5
Request:
{
"authorization": "80aXr8Vm0iFZl3Rlo2tR"
}
Response:
{
"type": "authorization",
"state": "OK"
}
To resend initialization data user request below.
Request:
{
"command": "sendInitData"
}
Response:
{"type":"init","data":{"type":"SwitcherStart","default_playlist_id":"c26b737ea-1178-4f9e-851c-479cbdd6e97d"}}
14:29:19
{"type":"init","data":{"playlist_active_stream":0,"stream_name":"c4f673956-99c5-4a92-8854-c369d1f7da27","playlist_name":"c4f673956-99c5-4a92-8854-c369d1f7da27","type":"StreamSwitchVideo"}}
14:29:19
{"type":"init","data":{"playlist_active_stream":0,"stream_name":"c4f673956-99c5-4a92-8854-c369d1f7da27","playlist_name":"c4f673956-99c5-4a92-8854-c369d1f7da27","type":"StreamSwitchAudio"}}
14:29:19
{"type":"init","data":{"type":"StreamAvailable","stream_name":"c4f673956-99c5-4a92-8854-c369d1f7da27","state":true}}
14:29:19
{"type":"init","data":{"type":"StreamAvailable","stream_name":"c26b737ea-1178-4f9e-851c-479cbdd6e97d","state":true}}
Change PTZ position of the camera
For PTZ changes use AXIS API directly.
Example:
http://IPADDR[:PORT]/axis-cgi/com/ptz.cgi?camera=CAMERAID&gotoserverpresetname=PTZNAME
where
IPADDR[:PORT] is an IP address:port of the camera. E.g. 192.168.91.202
CAMERAID is and ID of a View Area of your camera, for real PTZ cameras use always value 1
PTZNAME is the name of your PTZ position and is case sensitive