智慧型裝置管理 (SDM) API 支援 Google Nest Doorbell (有線版)。這部裝置會傳回 DOORBELL 的裝置類型:
sdm.devices.types.DOORBELL
Google Nest Doorbell (有線版) 配備攝影機,功能與 CAMERA 的裝置類型相同。
性狀
參考資料
下列與這部裝置相關的特徵、指令或事件:
特徵 | 說明 | 指令 | 活動 |
---|---|---|---|
CameraClipPreview | 這個特徵屬於任何支援下載短片預覽畫面的裝置。 | ClipPreview | |
CameraLiveStream | 這項特性屬於任何支援直播功能的裝置。 | GenerateWebRtcStream ExtendWebRtcStream StopWebRtcStream | |
CameraMotion | 該特徵屬於支援動作偵測事件的任何裝置。 | 動態 | |
CameraPerson | 該特徵屬於支援人員偵測事件的任何裝置。 | 使用者 | |
DoorbellChime | 這項特徵屬於任何支援門鈴鈴聲及相關媒體事件的裝置。 | 管鐘 | |
資訊 | 這項特徵隸屬於任何裝置, |
JSON
如果 GET 回應中沒有特徵,表示裝置目前不支援該 trait。詳情請參閱「裝置類型」一節。
{ "type" : "sdm.devices.types.DOORBELL", "traits" : { "sdm.devices.traits.CameraClipPreview" : {}, "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.DoorbellChime" : {}, "sdm.devices.traits.Info" : { "customName" : "My device" } } }
處理門鈴和攝影機事件
DOORBELL 裝置類型可能會觸發下列事件: 舉例來說,以下是按下門鈴按鈕的情況:酬載
{ "eventId" : "d608568d-eef0-4a5a-89d6-5f333ca9b3ac",
"timestamp" : "2019-01-01T00:00:01Z",
"resourceUpdate" : { "name" : "enterprises/project-id/devices/device-id", "events" : { "sdm.devices.events.DoorbellChime.Chime
" : { "eventSessionId" : "CjY5Y3VKaTZwR3o4Y19YbTVfMF...", "eventId" : "nZY1PQQx190d1RaAMZDa0kn8oQ..." } } } "userId" : "AVPHwEuBfnPOnTqzVFT4IONX2Qqhu9EJ4ubO-bNnQ-yi",
"resourceGroup" : [ "enterprises/project-id/devices/device-id" ] }
短片可供預覽,且其中包含含有 previewUrl
的事件。短片預覽畫面可與活動同時發布。使用 eventSessionId
,即可將這個事件和相關 previewUrl
與一或多個支援的事件建立關聯。
酬載
{ "eventId" : "57497c68-cd61-4cf8-8909-38c520d91bdc", "timestamp" : "2019-01-01T00:00:45Z", "resourceUpdate" : { "name" : "enterprises/project-id/devices/device-id", "events" : { "sdm.devices.events.DoorbellChime.Chime" : { "eventSessionId" : "CjY5Y3VKaTZwR3o4Y19YbTVfMF...", "eventId" : "nZY1PQQx190d1RaAMZDa0kn8oQ..." }, "sdm.devices.events.CameraClipPreview.ClipPreview" : { "eventSessionId" : "CjY5Y3VKaTZwR3o4Y19YbTVfMF...", "previewUrl" : "https://previewUrl/..." } } }, "userId": "AVPHwEuBfnPOnTqzVFT4IONX2Qqhu9EJ4ubO-bNnQ-yi", "eventThreadId" : "d67cd3f7-86a7-425e-8bb3-462f92ec9f59", "eventThreadState" : "STARTED", "resourceGroup" : [ "enterprises/project-id/devices/device-id" ] } }
如要預覽片段,請在 HTTP 授權標頭中使用 OAuth 存取權杖對 previewUrl
發出 GET 呼叫:
預覽
curl -H 'Authorization: Bearer access-token' \
https://previewUrl/...
短片預覽是 mp4 格式的 10 影格影片檔案。您可以選擇顯示 mp4 影片檔案,或是將其轉碼為其他格式 (例如 GIF 動畫),以便顯示完整的 10 個影格序列。選取剪輯預覽方法時,應考慮裝置用戶端功能。
觀看直播
你可以透過攝影機存取即時影像串流。此裝置支援下列串流格式:
- WebRTC
如需攝影機和支援的串流格式的完整清單,請參閱「支援的裝置」。
如要存取直播,請使用CameraLiveStream特徵適當的「產生」Format串流指令。
WebRTC
如果是 WebRTC 串流,請在 CameraLiveStream trait 的 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" : "3u027jG0wsg6VZepGloahNNGVO..." } }
建議你參考網頁應用程式範例,瞭解如何產生成功的直播。這個範例會產生有效的 offerSdp
,符合 Nest 攝影機的所有 SDP 優惠限制。
Nest 攝影機的 SDP 優惠方案須符合下列限制:
- 僅支援統一格式。不支援方案 B。
- 所有媒體行 (
m=
) 都必須出現在優惠中,且必須依照下列順序排列:- 音訊內容
- 影片
- 調度應用程式資源
- 支援「Trickle ICE」,但並非必要。
- 音訊僅支援 Opus 轉碼器。
- 音訊設定必須設為
a=recvonly
(只能接收)。 - 優惠必須以
\r\n
或\n
為換行字元結尾。
answerSdp
必須在收到回應後的 30 秒內產生直播活動,否則就會過期。如果到期,請再次執行 GenerateWebRtcStream 指令,接收新的 answerSdp
。
為直播開啟 WebRTC 頻道時,請務必建立資料管道及影片頻道。
查看有效優惠的示例
未設定格式:
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
延長直播時間
攝影機即時串流工作階段的有效期限為 5 分鐘。如需延長直播生命週期,請針對你產生的串流格式,使用適當的「延長Format串流」指令。 CameraLiveStream 特徵。
WebRTC
有線
WebRTC 串流只能在接線的攝影機上延長。將電池供電的攝影機在充電時視為有電線。如果攝影機是以電池供電,系統會忽略延長 WebRTC 串流的要求。
如要擴充 WebRTC 串流,請使用 CameraLiveStream 特徵的 ExtendWebRtcStream 指令指定串流的媒體工作階段 ID:
要求
POST /enterprises/project-id/devices/device-id:executeCommand
{
"command" : "sdm.devices.commands.CameraLiveStream.ExtendWebRtcStream
",
"params" : {
"mediaSessionId" : "3u027jG0wsg6VZepGloahNNGVO..."
}
}
回應
{ "results" : { "expiresAt" : "2018-01-04T18:30:00.000Z", "mediaSessionId" : "3u027jG0wsg6VZepGloahNNGVO..." } }
停止直播
在停止使用攝影機即時影像時,請務必停止錄影,並使串流失效。方法是針對產生的串流格式,使用CameraLiveStream特徵的適當 StopFormat串流指令。
WebRTC
如要停止 WebRTC 串流,請使用 CameraLiveStream 特徵的 StopWebRtcStream 指令指定媒體工作階段 ID:
要求
POST /enterprises/project-id/devices/device-id:executeCommand
{
"command" : "sdm.devices.commands.CameraLiveStream.StopWebRtcStream
",
"params" : {
"mediaSessionId" : "3u027jG0wsg6VZepGloahNNGVO..."
}
}
回應
{}
錯誤
下列與這部裝置相關的錯誤代碼可能會傳回:
錯誤訊息 | RPC | 疑難排解 |
---|---|---|
優惠 SDP 無效。 | INVALID_ARGUMENT |
優惠 SDP 音訊必須設為 a=recvonly (僅接收)。 |
優惠 SDP 缺少 CRLF。 | INVALID_ARGUMENT |
嘗試產生 WebRTC 串流時,offerSdp 字串的結尾會缺少換行字元。請確認 offerSdp 字串的結尾是 \r\n 或 \n ,然後再次嘗試產生串流。 |
優惠 SDP m 行無效。 | INVALID_ARGUMENT |
提供 SDP 必須依序包含音訊、視訊及應用範圍的全部三行內容。 |
因逾時而無法擷取答案 SDP。 | DEADLINE_EXCEEDED |
嘗試重新產生 WebRTC 直播。 |
如需 API 錯誤代碼的完整清單,請參閱 API 錯誤代碼參考資料。