WebRTC, Web RealTime Communication, is an open standard for real-time peer-to-peer communication on IP networks. WebRTC allows audio and video communication and streaming to work inside web pages by allowing direct peer-to-peer communication, eliminating the need to install plugins or download native apps.
A connection through WebRTC is established through a process called signaling. The WebRTC standard doesn't recommend any specific way to implement signaling. In XProtect, signaling is implemented through a RESTful API and a WebSocket API, both hosted by the API Gateway.
For more information, see Introduction to WebRTC support in XProtect.
Download the OpenAPI specification for the WebRTC signaling API from https://doc.developer.milestonesys.com/mipvmsapi/api/webrtc-rest/v1/openapi.yaml.
This can only be called on a valid session id. To support trickle ICE, call this method continuously during the session to check for new candidates.
sessionId required | string <uuid> |
To support trickle ICE, call this method whenever a new ICE candidate is found
sessionId required | string <uuid> |
sessionId | string <uuid> Session id of the session where the ICE candidates are used |
candidates | Array of strings or null List of ICE candidates |
{- "sessionId": "f6567dd8-e069-418e-8893-7d22fcf12459",
- "candidates": [
- "string"
]
}
The user has to have access to the camera in order for the session to be created. Note: Cameras with masking enabled cannot be used, the reason being a H.264 camera with masking enabled will output a JPEG stream which WebRTC does not support
sessionId | string or null Unique id of the session |
cameraId | string or null Id of the camera that is used in the session |
token | string or null OAuth token, avaible only for patching. It cannot be retrieved |
resolution | string or null Added for future use |
offerSDP | string or null WebRTC SDP offer |
answerSDP | string or null WebRTC SDP answer |
streamId | string or null Selects a specific stream from a camera with multiple streams |
object (PlaybackTimeNode) | |
Array of objects or null (IceServer) List of STUN and TURN servers to use |
{- "sessionId": "string",
- "cameraId": "string",
- "token": "string",
- "resolution": "string",
- "offerSDP": "string",
- "answerSDP": "string",
- "streamId": "string",
- "playbackTimeNode": {
- "playbackTime": "string",
- "skipGaps": true,
- "speed": 0.1
}, - "iceServers": [
- {
- "url": "string",
- "userName": "string",
- "credential": "string"
}
]
}
Currently it's possible to update the AnswerSDP and the Token. AnswerSDP should be updated after the session has been initiated if the OfferSDP is acceptable. Token should be called before it times out. Default timeout for a Token is 1 hour.
sessionId required | string <uuid> |
sessionId | string or null Unique id of the session |
cameraId | string or null Id of the camera that is used in the session |
token | string or null OAuth token, avaible only for patching. It cannot be retrieved |
resolution | string or null Added for future use |
offerSDP | string or null WebRTC SDP offer |
answerSDP | string or null WebRTC SDP answer |
streamId | string or null Selects a specific stream from a camera with multiple streams |
object (PlaybackTimeNode) | |
Array of objects or null (IceServer) List of STUN and TURN servers to use |
{- "sessionId": "string",
- "cameraId": "string",
- "token": "string",
- "resolution": "string",
- "offerSDP": "string",
- "answerSDP": "string",
- "streamId": "string",
- "playbackTimeNode": {
- "playbackTime": "string",
- "skipGaps": true,
- "speed": 0.1
}, - "iceServers": [
- {
- "url": "string",
- "userName": "string",
- "credential": "string"
}
]
}