Smart Home CameraStream Trait Schema

action.devices.traits.CameraStream - This trait belongs to devices which have the capability to stream video feeds to third party screens, Chromecast-connected screens or an Android phone. By and large, these are currently security cameras or baby cameras. But this would also apply to more complex devices which have a camera on them (for example, video-conferencing robotics/devices or a vacuum robot with a camera on it).

Device ATTRIBUTES

Attribute Definition
cameraStreamSupportedProtocols Ordered list of strings describing supported media types, according to preference, for the real-time stream.
cameraStreamNeedAuthToken Bool to indicate if an Auth token will be needed to stream the camera feed.
cameraStreamNeedDrmEncryption Bool to indicate if stream content requires DRM encryption.

Sample SYNC Request and Response

Request
{
  "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
  "inputs": [{
    "intent": "action.devices.SYNC",
  }]
}
Response
{
  "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
  "payload": {
    "agentUserId": "1836.15267389",
    "devices": [{
      "id": "123",
      "type": "action.devices.types.CAMERA",
      "traits": [
        "action.devices.traits.CameraStream"
      ],
      "name": {
        "defaultNames": ["Sirius Cybernetics Corporation 3000"],
        "name": "Front Camera",
        "nicknames": ["Camera"]
      },
      "willReportState": true,
      "attributes": {
        "cameraStreamSupportedProtocols": ["hls", "dash"],
        "cameraStreamNeedAuthToken": true,
        "cameraStreamNeedDrmEncryption": false
      },
      "customData": {
        "fooValue": 74,
        "barValue": true,
        "bazValue": "lambtwirl"
      }
    }]
  }
}
Validator

Device STATES

None

Device COMMANDS

Note that this command is not straight execution as with other traits/commands, but the first stage of a pipeline; GetCameraStream returns an address which the Assistant feeds to the media target (for now, just Chomecast-enabled targets). However, since these have real effects, rather than simply querying potentially cached data, they are EXECUTE commands, not QUERY.
Command Parameters/Definition
action.devices.commands.GetCameraStream Begin streaming the camera (the return URL of stream) in order to present on a screen such as the user's phone, the Assistant surface itself, or another media/Cast target.
  • StreamToChromecast Bool to indicate whether the stream will be played on a Chromecast device.
  • SupportedStreamProtocols List of strings. We send along the supported media types/formats of the desired destination; client should return a streaming URL pointing to one of these formats.
SupportedStreamProtocols returns the following:
  • cameraStreamAccessUrl String. URL endpoint for retrieving the realtime stream.
  • cameraStreamReceiverAppId String. Optional. Cast receiver id if the steam has to be processed by a specific receiver.
  • cameraStreamAuthToken String. Optional. A token for the specific receiver to authenticate the stream.

Sample EXECUTE Request and Response

Show front door camera on my Chromecast.
Request
{
  "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
  "inputs": [{
    "intent": "action.devices.EXECUTE",
    "payload": {
      "commands": [{
        "devices": [{
          "id": "123",
          "customData": {
            "fooValue": 74,
            "barValue": true,
            "bazValue": "lambtwirl"
          }
        }],
        "execution": [{
          "command": "action.devices.commands.GetCameraStream",
          "params": {
            "StreamToChromecast": true,
            "SupportedStreamProtocols": [ "progressive_mp4", "hls", "dash", "smooth_stream" ]
          }
        }]
      }]
    }
  }]
}
Response
{
  "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
  "payload": {
    "commands": [{
      "ids": ["123"],
      "status": "SUCCESS",
      "states": {
        "cameraStreamAccessUrl": "https://fluffysheep.com/baaaaa.mp4"
        "cameraStreamReceiverAppId": "1g2f89213hg"
        "cameraStreamAuthToken": "12657342190192783"
      }
    }]
  }
}

Device ERRORS

The error codes extend the primary list in the DevGuide. Additional errors will be added as needed.

resourceUnavailable - Any failure related to generating the stream url.

Supported Video Formats

The generic Cast Receiver utilizing MPL could support the following streaming media protocols:

  • HLS (HTTP Live Streaming)
  • DASH (Dynamic Adaptive Streaming over HTTP)
  • Smooth Streaming
  • Progressive MP4 (most likely to be used only for Clips)

If DRM encryption is required, our Cast Devices support the following CDMs:

  • Widevine
  • PlayReady

See the list of supported codecs.

Custom Receivers for Camera partners (that is, Camera Device from Vendor A requires Cast Receiver by Vendor A) can support everything that can be decoded on Cast (see above, plus any other proprietary protocols than can be implemented using HTML5/MSE/EME); running a custom receiver allows for additional branding and custom business logic (interactions with third party APIs).