カメラ(従来版)

Google Nest Cam

すべての旧型の Google Nest Cam は、Smart Device Management(SDM)API でサポートされています。

  1. Google Nest Cam Indoor
  2. Google Nest Cam Outdoor
  3. Google Nest Cam IQ Indoor
  4. Google Nest Cam IQ アウトドア

これらのデバイスは、デバイスタイプとして CAMERA を返します。

sdm.devices.types.CAMERA

Google Nest Doorbell(旧型)Google Nest Hub Max もカメラとして機能し、同様の特性を備えていますが、それぞれ DOORBELL と DISPLAY のデバイスタイプを返します。

Google Nest Cam Indoor と Google Nest Cam Outdoor は、Nest アプリまたは Google Home アプリのいずれかで使用できますが、両方を同時に使用することはできません。カメラが Nest アプリに登録されている場合は、RTSP をサポートしています。また、カメラが Google Home アプリに接続されている場合は、WebRTC をサポートします。CameraLiveStream トレイトの supportedProtocols フィールドは、サポートされている形式を示します。詳しくは、デバイスを Google Home アプリに移行するのサポート記事をご覧ください。

これらのデバイスタイプに固有の機能について詳しくは、ドアホンディスプレイのデバイスガイドをご覧ください。

トレイト

リファレンス

このデバイスに関連するトレイト、コマンド、イベントは次のとおりです。

トレイト説明コマンドイベント
CameraEventImageこのトレイトは、イベントからの画像の生成をサポートするデバイスに使用します。GenerateImage
CameraImageこのトレイトは、画像の撮影をサポートするすべてのデバイスに使用します。
CameraLiveStreamこのトレイトは、ライブ ストリーミングをサポートするデバイスに使用します。GenerateRtspStream
ExtendRtspStream
StopRtspStream
GenerateWebRtcStream
ExtendWebRtcStream
StopWebRtcStream
CameraMotionこのトレイトは、モーション検出イベントをサポートするデバイスに使用します。モーション
CameraPersonこのトレイトは、人物検出イベントをサポートするデバイスに使用します。Person
CameraSoundこのトレイトは、サウンド検知イベントをサポートするデバイスに使用します。サウンド
情報このトレイトは、デバイス関連の情報を提供するデバイスに使用します。

JSON

GET レスポンスにトレイトがない場合は、そのトレイトまたは機能が現在デバイスで利用できないことを示します。詳細については、デバイスタイプをご覧ください。

{
  "type" : "sdm.devices.types.CAMERA",
  "traits" : {
    "sdm.devices.traits.CameraEventImage" : {},
    "sdm.devices.traits.CameraImage" : {
      "maxImageResolution" : {
        "width" : 1280,
        "height" : 960
      }
    },
    "sdm.devices.traits.CameraLiveStream" : {
      "maxVideoResolution" : {
        "width" : 640,
        "height" : 480
      },
      "videoCodecs" : ["H264"],
      "audioCodecs" : ["AAC"],
      "supportedProtocols" : ["WEB_RTC"]
    },
    "sdm.devices.traits.CameraMotion" : {},
    "sdm.devices.traits.CameraPerson" : {},
    "sdm.devices.traits.CameraSound" : {},
    "sdm.devices.traits.Info" : {
      "customName" : "My device"
    }
  }
}

カメラ イベントを処理する

以下のイベントは、カメラ デバイスタイプ、またはカメラを搭載したドアホンやディスプレイ(Google Nest Doorbell(以前のモデル)や Google Nest Hub Max など)からトリガーされる可能性があります。

タイプ 要素 説明
イベント CameraMotion トレイトの Motion イベント カメラで動きが検出されました。
イベント CameraPerson トレイトの Person イベント カメラが人物を検出しました。
イベント CameraSound トレイトの Sound イベント カメラが音を検出しました。
たとえば、カメラが動きを検出した場合は次のようになります。

ペイロード

{
  "eventId" : "74c71557-228d-4dd0-a5ac-934dd0444d08",
"timestamp" : "2019-01-01T00:00:01Z",
"resourceUpdate" : { "name" : "enterprises/project-id/devices/device-id", "events" : { "sdm.devices.events.CameraMotion.Motion" : { "eventSessionId" : "CjY5Y3VKaTZwR3o4Y19YbTVfMF...", "eventId" : "R0JGM7SMYALZARwkaUMcLDSNGA...", } } } "userId" : "AVPHwEuBfnPOnTqzVFT4IONX2Qqhu9EJ4ubO-bNnQ-yi",
"resourceGroup" : [ "enterprises/project-id/devices/device-id" ] }
このイベントのペイロードには、GenerateImage コマンドで使用できる eventId が含まれています。このコマンドは、イベントに関連するカメラ画像のダウンロード URL を返します。

リクエスト

POST /enterprises/project-id/devices/device-id:executeCommand
{
  "command" : "sdm.devices.commands.CameraEventImage.GenerateImage",
  "params" : {
    "eventId" : "i6CqptAgYmwBZBapJUmqfdQ9JJ..."
  }
}

レスポンス

{
  "results" : {
    "url" : "https://domain/sdm_event_snapshot/dGNUlTU2CjY5Y3VKaTZwR3o4Y1...",
    "token" : "g.0.eventToken"
  }
}

カメラ画像をダウンロードする

GenerateImage コマンド レスポンスから url への GET 呼び出しを行い、HTTP 認証ヘッダーの token を基本認証で使用して、カメラ画像をダウンロードします。

curl -H "Authorization: Basic g.0.eventToken" \
      https://domain/sdm_event_snapshot/dGNUlTU2CjY5Y3VKaTZwR3o4Y1...

width または height クエリ パラメータを使用して、ダウンロードした画像の解像度をカスタマイズします。これらのパラメータのうち、指定する必要があるのは 1 つだけです。もう一方のパラメータは、カメラのアスペクト比に応じて自動的にスケーリングされます。

たとえば、カメラのアスペクト比が 4:3 の場合、解像度 480 x 360 のカメラ画像をダウンロードするには、幅または高さのいずれかを指定します。

curl -H "Authorization: Basic g.0.eventToken" \
      https://domain/sdm_event_snapshot/dGNUlTU2CjY5Y3VKaTZwR3o4Y1...?width=480

高さ

curl -H "Authorization: Basic g.0.eventToken" \
      https://domain/sdm_event_snapshot/dGNUlTU2CjY5Y3VKaTZwR3o4Y1...?height=360

ダウンロード URL には他の制限も適用されます。

  • 両方のパラメータが URL で指定されている場合、width が使用され、height は無視されます。
  • URL でどちらのパラメータも指定されていない場合、width のデフォルト値として 480 が選択されます。

画像プロパティについては、 CameraImage トレイトをご覧ください。

ライブ ストリームにアクセスする

カメラからのライブ ストリームにアクセスできます。このデバイスでは、次のストリーム形式がサポートされています。

  • RTSP
  • WebRTC

カメラとサポートされているストリーム形式の完全なリストについては、サポートされているデバイスをご覧ください。

ライブ ストリームにアクセスするには、CameraLiveStreamトレイトの適切な GenerateFormatStream コマンドを使用します。

WebRTC


WebRTC ストリームの場合は、CameraLiveStream トレイトの GenerateWebRtcStream コマンドで offerSdp を送信して answerSdp を取得します。

リクエスト

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

レスポンス

{
  "results" : {
    "answerSdp" : "answerSdp",
    "expiresAt" : "2020-01-04T18:30:00.000Z",
    "mediaSessionId" : "kV587EcoHzEery6jLALTb8X1p_..."
  }
}

ウェブ アプリケーションのサンプルを使用して、ライブ配信を成功させる方法を学ぶことをおすすめします。このサンプルでは、Google Nest カメラの SDP オファーのすべての制限を満たす有効な offerSdp を生成します。

Google Nest カメラの SDP オファーは、次の制限を満たしている必要があります。

  • 統一形式のみがサポートされています。プラン B はサポートされていません。
  • すべてのメディア行(m=)が特典に存在し、次の順序でなければなりません。
    1. オーディオ
    2. 動画
    3. アプリケーション
  • Trickle ICE はサポートされていますが、必須ではありません。
  • 音声では Opus コーデックのみがサポートされています。
  • 音声設定は a=recvonly(受信のみ)に設定する必要があります。
  • オファーの末尾は、\r\n または \n のいずれかの改行文字にする必要があります。

answerSdp は、レスポンスを受け取ってから 30 秒以内にライブ ストリームを生成するために使用する必要があります。それ以外の場合、answerSdp は期限切れになります。有効期限が切れた場合は、GenerateWebRtcStream コマンドを再度実行して、新しい answerSdp を受け取ります。

ライブ ストリームの WebRTC チャネルを開くときは、データチャネルと動画チャネルの両方を作成してください。

有効な特典の例を見る

Unformatted:

v=0\r\no=- 2214114893783582286 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE 0 1 2\r\na=extmap-allow-mixed\r\na=msid-semantic: WMS\r\nm=audio 9 UDP/TLS/RTP/SAVPF 111 63 103 104 9 0 8 106 105 13 110 112 113 126\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:6ReD\r\na=ice-pwd:QBmcZYd/t+InpMVkxQEEXnE4\r\na=ice-options:trickle\r\na=fingerprint:sha-256 DD:7E:6F:CD:B8:13:4E:37:D2:92:6D:8E:30:FB:FE:13:29:C9:F8:FD:78:0B:C4:59:42:61:BC:CF:02:91:6B:3C\r\na=setup:actpass\r\na=mid:0\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid\r\na=recvonly\r\na=rtcp-mux\r\na=rtpmap:111 opus/48000/2\r\na=rtcp-fb:111 transport-cc\r\na=fmtp:111 minptime=10;useinbandfec=1\r\na=rtpmap:63 red/48000/2\r\na=fmtp:63 111/111\r\na=rtpmap:103 ISAC/16000\r\na=rtpmap:104 ISAC/32000\r\na=rtpmap:9 G722/8000\r\na=rtpmap:0 PCMU/8000\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:106 CN/32000\r\na=rtpmap:105 CN/16000\r\na=rtpmap:13 CN/8000\r\na=rtpmap:110 telephone-event/48000\r\na=rtpmap:112 telephone-event/32000\r\na=rtpmap:113 telephone-event/16000\r\na=rtpmap:126 telephone-event/8000\r\nm=video 9 UDP/TLS/RTP/SAVPF 96 97 98 99 100 101 122 102 121 127 120 125 107 108 109 35 36 124 119 123 118 114 115 116 37\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:6ReD\r\na=ice-pwd:QBmcZYd/t+InpMVkxQEEXnE4\r\na=ice-options:trickle\r\na=fingerprint:sha-256 DD:7E:6F:CD:B8:13:4E:37:D2:92:6D:8E:30:FB:FE:13:29:C9:F8:FD:78:0B:C4:59:42:61:BC:CF:02:91:6B:3C\r\na=setup:actpass\r\na=mid:1\r\na=extmap:14 urn:ietf:params:rtp-hdrext:toffset\r\na=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=extmap:13 urn:3gpp:video-orientation\r\na=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=extmap:5 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay\r\na=extmap:6 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type\r\na=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-timing\r\na=extmap:8 http://www.webrtc.org/experiments/rtp-hdrext/color-space\r\na=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid\r\na=extmap:10 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id\r\na=extmap:11 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id\r\na=recvonly\r\na=rtcp-mux\r\na=rtcp-rsize\r\na=rtpmap:96 VP8/90000\r\na=rtcp-fb:96 goog-remb\r\na=rtcp-fb:96 transport-cc\r\na=rtcp-fb:96 ccm fir\r\na=rtcp-fb:96 nack\r\na=rtcp-fb:96 nack pli\r\na=rtpmap:97 rtx/90000\r\na=fmtp:97 apt=96\r\na=rtpmap:98 VP9/90000\r\na=rtcp-fb:98 goog-remb\r\na=rtcp-fb:98 transport-cc\r\na=rtcp-fb:98 ccm fir\r\na=rtcp-fb:98 nack\r\na=rtcp-fb:98 nack pli\r\na=fmtp:98 profile-id=0\r\na=rtpmap:99 rtx/90000\r\na=fmtp:99 apt=98\r\na=rtpmap:100 VP9/90000\r\na=rtcp-fb:100 goog-remb\r\na=rtcp-fb:100 transport-cc\r\na=rtcp-fb:100 ccm fir\r\na=rtcp-fb:100 nack\r\na=rtcp-fb:100 nack pli\r\na=fmtp:100 profile-id=2\r\na=rtpmap:101 rtx/90000\r\na=fmtp:101 apt=100\r\na=rtpmap:122 VP9/90000\r\na=rtcp-fb:122 goog-remb\r\na=rtcp-fb:122 transport-cc\r\na=rtcp-fb:122 ccm fir\r\na=rtcp-fb:122 nack\r\na=rtcp-fb:122 nack pli\r\na=fmtp:122 profile-id=1\r\na=rtpmap:102 H264/90000\r\na=rtcp-fb:102 goog-remb\r\na=rtcp-fb:102 transport-cc\r\na=rtcp-fb:102 ccm fir\r\na=rtcp-fb:102 nack\r\na=rtcp-fb:102 nack pli\r\na=fmtp:102 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f\r\na=rtpmap:121 rtx/90000\r\na=fmtp:121 apt=102\r\na=rtpmap:127 H264/90000\r\na=rtcp-fb:127 goog-remb\r\na=rtcp-fb:127 transport-cc\r\na=rtcp-fb:127 ccm fir\r\na=rtcp-fb:127 nack\r\na=rtcp-fb:127 nack pli\r\na=fmtp:127 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42001f\r\na=rtpmap:120 rtx/90000\r\na=fmtp:120 apt=127\r\na=rtpmap:125 H264/90000\r\na=rtcp-fb:125 goog-remb\r\na=rtcp-fb:125 transport-cc\r\na=rtcp-fb:125 ccm fir\r\na=rtcp-fb:125 nack\r\na=rtcp-fb:125 nack pli\r\na=fmtp:125 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f\r\na=rtpmap:107 rtx/90000\r\na=fmtp:107 apt=125\r\na=rtpmap:108 H264/90000\r\na=rtcp-fb:108 goog-remb\r\na=rtcp-fb:108 transport-cc\r\na=rtcp-fb:108 ccm fir\r\na=rtcp-fb:108 nack\r\na=rtcp-fb:108 nack pli\r\na=fmtp:108 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42e01f\r\na=rtpmap:109 rtx/90000\r\na=fmtp:109 apt=108\r\na=rtpmap:35 AV1/90000\r\na=rtcp-fb:35 goog-remb\r\na=rtcp-fb:35 transport-cc\r\na=rtcp-fb:35 ccm fir\r\na=rtcp-fb:35 nack\r\na=rtcp-fb:35 nack pli\r\na=rtpmap:36 rtx/90000\r\na=fmtp:36 apt=35\r\na=rtpmap:124 H264/90000\r\na=rtcp-fb:124 goog-remb\r\na=rtcp-fb:124 transport-cc\r\na=rtcp-fb:124 ccm fir\r\na=rtcp-fb:124 nack\r\na=rtcp-fb:124 nack pli\r\na=fmtp:124 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=4d0032\r\na=rtpmap:119 rtx/90000\r\na=fmtp:119 apt=124\r\na=rtpmap:123 H264/90000\r\na=rtcp-fb:123 goog-remb\r\na=rtcp-fb:123 transport-cc\r\na=rtcp-fb:123 ccm fir\r\na=rtcp-fb:123 nack\r\na=rtcp-fb:123 nack pli\r\na=fmtp:123 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=640032\r\na=rtpmap:118 rtx/90000\r\na=fmtp:118 apt=123\r\na=rtpmap:114 red/90000\r\na=rtpmap:115 rtx/90000\r\na=fmtp:115 apt=114\r\na=rtpmap:116 ulpfec/90000\r\na=rtpmap:37 flexfec-03/90000\r\na=rtcp-fb:37 goog-remb\r\na=rtcp-fb:37 transport-cc\r\na=fmtp:37 repair-window=10000000\r\nm=application 9 UDP/DTLS/SCTP webrtc-datachannel\r\nc=IN IP4 0.0.0.0\r\na=ice-ufrag:6ReD\r\na=ice-pwd:QBmcZYd/t+InpMVkxQEEXnE4\r\na=ice-options:trickle\r\na=fingerprint:sha-256 DD:7E:6F:CD:B8:13:4E:37:D2:92:6D:8E:30:FB:FE:13:29:C9:F8:FD:78:0B:C4:59:42:61:BC:CF:02:91:6B:3C\r\na=setup:actpass\r\na=mid:2\r\na=sctp-port:5000\r\na=max-message-size:262144\r\n

フォーマット済み:

v=0
o=- 2214114893783582286 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE 0 1 2
a=extmap-allow-mixed
a=msid-semantic: WMS
m=audio 9 UDP/TLS/RTP/SAVPF 111 63 103 104 9 0 8 106 105 13 110 112 113 126
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=ice-ufrag:6ReD
a=ice-pwd:QBmcZYd/t+InpMVkxQEEXnE4
a=ice-options:trickle
a=fingerprint:sha-256 DD:7E:6F:CD:B8:13:4E:37:D2:92:6D:8E:30:FB:FE:13:29:C9:F8:FD:78:0B:C4:59:42:61:BC:CF:02:91:6B:3C
a=setup:actpass
a=mid:0
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid
a=recvonly
a=rtcp-mux
a=rtpmap:111 opus/48000/2
a=rtcp-fb:111 transport-cc
a=fmtp:111 minptime=10;useinbandfec=1
a=rtpmap:63 red/48000/2
a=fmtp:63 111/111
a=rtpmap:103 ISAC/16000
a=rtpmap:104 ISAC/32000
a=rtpmap:9 G722/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:106 CN/32000
a=rtpmap:105 CN/16000
a=rtpmap:13 CN/8000
a=rtpmap:110 telephone-event/48000
a=rtpmap:112 telephone-event/32000
a=rtpmap:113 telephone-event/16000
a=rtpmap:126 telephone-event/8000
m=video 9 UDP/TLS/RTP/SAVPF 96 97 98 99 100 101 122 102 121 127 120 125 107 108 109 35 36 124 119 123 118 114 115 116 37
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=ice-ufrag:6ReD
a=ice-pwd:QBmcZYd/t+InpMVkxQEEXnE4
a=ice-options:trickle
a=fingerprint:sha-256 DD:7E:6F:CD:B8:13:4E:37:D2:92:6D:8E:30:FB:FE:13:29:C9:F8:FD:78:0B:C4:59:42:61:BC:CF:02:91:6B:3C
a=setup:actpass
a=mid:1
a=extmap:14 urn:ietf:params:rtp-hdrext:toffset
a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:13 urn:3gpp:video-orientation
a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:5 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay
a=extmap:6 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type
a=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-timing
a=extmap:8 http://www.webrtc.org/experiments/rtp-hdrext/color-space
a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid
a=extmap:10 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id
a=extmap:11 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id
a=recvonly
a=rtcp-mux
a=rtcp-rsize
a=rtpmap:96 VP8/90000
a=rtcp-fb:96 goog-remb
a=rtcp-fb:96 transport-cc
a=rtcp-fb:96 ccm fir
a=rtcp-fb:96 nack
a=rtcp-fb:96 nack pli
a=rtpmap:97 rtx/90000
a=fmtp:97 apt=96
a=rtpmap:98 VP9/90000
a=rtcp-fb:98 goog-remb
a=rtcp-fb:98 transport-cc
a=rtcp-fb:98 ccm fir
a=rtcp-fb:98 nack
a=rtcp-fb:98 nack pli
a=fmtp:98 profile-id=0
a=rtpmap:99 rtx/90000
a=fmtp:99 apt=98
a=rtpmap:100 VP9/90000
a=rtcp-fb:100 goog-remb
a=rtcp-fb:100 transport-cc
a=rtcp-fb:100 ccm fir
a=rtcp-fb:100 nack
a=rtcp-fb:100 nack pli
a=fmtp:100 profile-id=2
a=rtpmap:101 rtx/90000
a=fmtp:101 apt=100
a=rtpmap:122 VP9/90000
a=rtcp-fb:122 goog-remb
a=rtcp-fb:122 transport-cc
a=rtcp-fb:122 ccm fir
a=rtcp-fb:122 nack
a=rtcp-fb:122 nack pli
a=fmtp:122 profile-id=1
a=rtpmap:102 H264/90000
a=rtcp-fb:102 goog-remb
a=rtcp-fb:102 transport-cc
a=rtcp-fb:102 ccm fir
a=rtcp-fb:102 nack
a=rtcp-fb:102 nack pli
a=fmtp:102 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f
a=rtpmap:121 rtx/90000
a=fmtp:121 apt=102
a=rtpmap:127 H264/90000
a=rtcp-fb:127 goog-remb
a=rtcp-fb:127 transport-cc
a=rtcp-fb:127 ccm fir
a=rtcp-fb:127 nack
a=rtcp-fb:127 nack pli
a=fmtp:127 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42001f
a=rtpmap:120 rtx/90000
a=fmtp:120 apt=127
a=rtpmap:125 H264/90000
a=rtcp-fb:125 goog-remb
a=rtcp-fb:125 transport-cc
a=rtcp-fb:125 ccm fir
a=rtcp-fb:125 nack
a=rtcp-fb:125 nack pli
a=fmtp:125 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f
a=rtpmap:107 rtx/90000
a=fmtp:107 apt=125
a=rtpmap:108 H264/90000
a=rtcp-fb:108 goog-remb
a=rtcp-fb:108 transport-cc
a=rtcp-fb:108 ccm fir
a=rtcp-fb:108 nack
a=rtcp-fb:108 nack pli
a=fmtp:108 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42e01f
a=rtpmap:109 rtx/90000
a=fmtp:109 apt=108
a=rtpmap:35 AV1/90000
a=rtcp-fb:35 goog-remb
a=rtcp-fb:35 transport-cc
a=rtcp-fb:35 ccm fir
a=rtcp-fb:35 nack
a=rtcp-fb:35 nack pli
a=rtpmap:36 rtx/90000
a=fmtp:36 apt=35
a=rtpmap:124 H264/90000
a=rtcp-fb:124 goog-remb
a=rtcp-fb:124 transport-cc
a=rtcp-fb:124 ccm fir
a=rtcp-fb:124 nack
a=rtcp-fb:124 nack pli
a=fmtp:124 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=4d0032
a=rtpmap:119 rtx/90000
a=fmtp:119 apt=124
a=rtpmap:123 H264/90000
a=rtcp-fb:123 goog-remb
a=rtcp-fb:123 transport-cc
a=rtcp-fb:123 ccm fir
a=rtcp-fb:123 nack
a=rtcp-fb:123 nack pli
a=fmtp:123 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=640032
a=rtpmap:118 rtx/90000
a=fmtp:118 apt=123
a=rtpmap:114 red/90000
a=rtpmap:115 rtx/90000
a=fmtp:115 apt=114
a=rtpmap:116 ulpfec/90000
a=rtpmap:37 flexfec-03/90000
a=rtcp-fb:37 goog-remb
a=rtcp-fb:37 transport-cc
a=fmtp:37 repair-window=10000000
m=application 9 UDP/DTLS/SCTP webrtc-datachannel
c=IN IP4 0.0.0.0
a=ice-ufrag:6ReD
a=ice-pwd:QBmcZYd/t+InpMVkxQEEXnE4
a=ice-options:trickle
a=fingerprint:sha-256 DD:7E:6F:CD:B8:13:4E:37:D2:92:6D:8E:30:FB:FE:13:29:C9:F8:FD:78:0B:C4:59:42:61:BC:CF:02:91:6B:3C
a=setup:actpass
a=mid:2
a=sctp-port:5000
a=max-message-size:262144

RTSP

RTSP ストリームの場合、CameraLiveStream トレイト コマンドの GenerateRtspStream コマンドは、ストリーム URL と関連する streamToken を返します。

リクエスト

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

レスポンス

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

次に、ストリーム URL を使用してカメラのライブ ストリームにアクセスします。

rtsps://someurl.com/CjY5Y3VKaTZwR3o4Y19YbTVfMF...?auth=g.0.streamingToken

RTSP ライブ配信 URL はクライアント間で共有できません。ストリーム URL は、一度に 1 つのクライアントでのみ使用できます。複数のクライアントが同じカメラから同時にストリーミングする場合は、個々のクライアントごとに RTSP コマンドを送信する必要があります。また、個々のクライアントは独自のストリーム URL を使用する必要があります。

ライブ配信を延長する

カメラのライブ ストリーミング セッションは 5 分間のみ有効です。ライブ ストリームの有効期間を延長する必要がある場合は、生成したストリーム形式の CameraLiveStream トレイトの適切な ExtendFormatStream コマンドを使用します。

WebRTC


  電源直結型   

WebRTC ストリームを延長できるのは、電源ケーブルで接続されたカメラのみです。バッテリー式のカメラは、充電のために電源に接続されている間は電源直結式と見なされます。カメラがバッテリーで動作している場合、アクティブな WebRTC ストリームを延長するリクエストは無視されます。

WebRTC ストリームを延長するには、CameraLiveStream トレイトの ExtendWebRtcStream コマンドでストリームのメディア セッション ID を指定します。

リクエスト

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

レスポンス

{
  "results" : {
    "expiresAt" : "2018-01-04T18:30:00.000Z",
    "mediaSessionId" : "kV587EcoHzEery6jLALTb8X1p_..."
  }
}

RTSP

RTSP ストリームを延長するには、CameraLiveStream トレイト コマンドの ExtendRtspStream コマンドを使用して、新しい streamExtensionToken 値と streamToken 値を取得します。

リクエスト

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

レスポンス

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

ライブ配信を視聴し続けるには、これらの新しい値でストリーム URL を更新します。

rtsps://someurl.com/dGNUlTU2CjY5Y3VKaTZwR3o4Y1...?auth=g.0.newStreamingToken

ライブ ストリームを停止する

カメラのライブ ストリームを使用しなくなった場合は、ストリームを停止して無効にする必要があります。これを行うには、生成したストリーム形式のCameraLiveStreamトレイトの適切な StopFormatStream コマンドを使用します。

WebRTC


WebRTC ストリームを停止するには、CameraLiveStream トレイトの StopWebRtcStream コマンドでメディア セッション ID を指定します。

リクエスト

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

レスポンス

{}

RTSP

RTSP ストリームを停止するには、トークンを使用して CameraLiveStream トレイト コマンドの StopRtspStream コマンドで無効にします。

リクエスト

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

レスポンス

{}

エラー

このデバイスに関連して、次のエラーコードが返されることがあります。

エラー メッセージ RPC トラブルシューティング
カメラはストリーミングには使用できません。 FAILED_PRECONDITION 技術的な問題により、カメラがオフラインになっているか、ストリーミングを利用できない状態です。
このコマンドはサポートされていません。 INVALID_ARGUMENT WebRTC をサポートするカメラに RTSP ライブ配信コマンドを使用した場合、または RTSP をサポートするカメラに WebRTC ライブ配信コマンドを使用した場合。
カメラの画像はダウンロードできなくなりました。 DEADLINE_EXCEEDED イベント画像は、イベントの公開から 30 秒後に期限切れになります。有効期限が切れる前に必ず画像をダウンロードしてください。
イベント ID がカメラに属していません。 FAILED_PRECONDITION カメラ イベントから返された正しい eventID を使用します。

API エラーコードの一覧については、API エラーコードのリファレンスをご覧ください。