CameraLiveStream Schema

sdm.devices.traits.CameraLiveStream

This trait belongs to any device that supports live streaming.

Fields

Field Description Data Type
maxVideoResolution Maximum resolution of the video live stream. VideoResolution
videoCodecs Video codecs supported for the live stream. array(string)
Value: ["H264"]
audioCodecs Audio codecs supported for the live stream. array(string)
Value: ["AAC"]

VideoResolution

Field Description Data Type
width Maximum image resolution width. May also be used as a query parameter in the download URL. int32
Example: 640
height Maximum image resolution height. May also be used as a query parameter in the download URL. int32
Example: 480

Sample GET request and response

Request

GET /enterprises/project-id/devices/device-id

Response

{
  "name" : "enterprises/project-id/devices/device-id",
  "traits" : {
    "sdm.devices.traits.CameraLiveStream" : {
      "maxVideoResolution" : {
        "width" : 640,
        "height" : 480
      },
      "videoCodecs" : ["H264"],
      "audioCodecs" : ["AAC"],
    }
  }
}

Commands

GenerateRtspStream

Request a token to access an RTSP live stream URL.

GenerateRtspStream request and response

Request

POST /enterprises/project-id/devices/device-id:executeCommand
{
  "command" : "sdm.devices.commands.CameraLiveStream.GenerateRtspStream",
  "params" : {}
}

Response

{
  "results" : {
    "streamUrls" : {
      "rtspUrl" : "rtsps://someurl.com/CjY5Y3VKaTZwR3o4Y19YbTVfMF...?auth=g.0.streamingToken"
    },
    "streamExtensionToken" : "CjY5Y3VKaTZwR3o4Y19YbTVfMF...",
    "streamToken" : "g.0.streamingToken",
    "expiresAt" : "2018-01-04T18:30:00.000Z"
  }
}

GenerateRtspStream response fields

Field Description Data Type
streamUrls Map of RTSP live stream URLs. object
streamExtensionToken Token to use to extend the streamToken for an RTSP live stream. string
Example: "CjY5Y3VKaTZwR3o4Y19YbTVfMF..."
streamToken Token to use to access an RTSP live stream. string
Example: "g.0.streamingToken"
expiresAt Time at which both streamExtensionToken and streamToken expire, in RFC 3339 format. string
Example: "2018-01-04T18:30:00.000Z"

ExtendRtspStream

Request a new RTSP live stream URL access token to replace a valid RTSP access token before it expires. This is also used to replace a valid RTSP token from a previous ExtendRtspStream command request.

ExtendRtspStream request and response

Request

POST /enterprises/project-id/devices/device-id:executeCommand
{
  "command" : "sdm.devices.commands.CameraLiveStream.ExtendRtspStream",
  "params" : {
    "streamExtensionToken" : "CjY5Y3VKaTZwR3o4Y19YbTVfMF..."
  }
}

Response

{
  "results" : {
    "streamExtensionToken" : "dGNUlTU2CjY5Y3VKaTZwR3o4Y1...",
    "streamToken" : "g.0.newStreamingToken",
    "expiresAt" : "2018-01-04T18:30:00.000Z"
  }
}

ExtendRtspStream request fields

Field Description Data Type
streamExtensionToken Token to use to request an extension to the RTSP streaming token. string
Example: "CjY5Y3VKaTZwR3o4Y19YbTVfMF..."

ExtendRtspStream response fields

Field Description Data Type
streamExtensionToken Token to use to view an existing RTSP live stream and to request an extension to the streaming token. string
Example: "dGNUlTU2CjY5Y3VKaTZwR3o4Y1..."
streamToken New token to use to access an existing RTSP live stream. string
Example: "g.0.newStreamingToken"
expiresAt Time at which both streamExtensionToken and streamToken expire, in RFC 3339 format. string
Example: "2018-01-04T18:30:00.000Z"

StopRtspStream

Invalidates a valid RTSP access token and stops the RTSP live stream tied to that access token.

StopRtspStream request and response

Request

POST /enterprises/project-id/devices/device-id:executeCommand
{
  "command" : "sdm.devices.commands.CameraLiveStream.StopRtspStream",
  "params" : {
    "streamExtensionToken" : "CjY5Y3VKaTZwR3o4Y19YbTVfMF..."
  }
}

Response

{}

StopRtspStream request fields

Field Description Data Type
streamExtensionToken Token to use to invalidate an existing RTSP live stream. string
Example: "CjY5Y3VKaTZwR3o4Y19YbTVfMF..."

Errors

See the API Error Code Reference for the full list of Device Access error codes.