กล้อง (เดิม)

Nest Cam

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 Outdoor

อุปกรณ์ต่อไปนี้จะแสดงประเภทอุปกรณ์เป็น "กล้อง"

sdm.devices.types.CAMERA

Google Nest Doorbell (รุ่นเดิม) และ Google Nest Hub Max ยังทำงานเป็นกล้องและมีลักษณะคล้ายกันด้วย แต่จะส่งคืนประเภทอุปกรณ์ "DOORBELL" และ "DISPLAY" ตามลำดับ

Google Nest Cam Indoor และ Google Nest Cam Outdoor ใช้ได้ในแอป Nest หรือแอป Google Home แต่ใช้ทั้ง 2 อย่างพร้อมกันไม่ได้ เมื่อกล้องอยู่ในแอป Nest กล้องจะรองรับ RTSP และเมื่อกล้องอยู่ในแอป Google Home กล้องก็รองรับ WebRTC ช่อง supportedProtocols ของลักษณะcameraLiveStream แสดงรูปแบบที่รองรับ ดูคำอธิบายเพิ่มเติมได้จากบทความการสนับสนุนของย้ายข้อมูลอุปกรณ์ไปยังแอป Google Home

ดูคู่มืออุปกรณ์กริ่งประตูและจอแสดงผลเพื่อดูข้อมูลเพิ่มเติมเกี่ยวกับฟีเจอร์เฉพาะสำหรับประเภทอุปกรณ์เหล่านั้น

ลักษณะเฉพาะ

ข้อมูลอ้างอิง

ลักษณะ คำสั่ง หรือเหตุการณ์ต่อไปนี้เกี่ยวข้องกับอุปกรณ์นี้

ลักษณะเฉพาะคำอธิบายคำสั่งกิจกรรม
CameraEventImageลักษณะนี้เป็นของอุปกรณ์ที่รองรับการสร้างรูปภาพจากเหตุการณ์GenerateImage
CameraImageลักษณะนี้เป็นของทุกอุปกรณ์ที่รองรับการถ่ายภาพ
CameraLiveStreamลักษณะนี้เป็นของอุปกรณ์ที่รองรับสตรีมมิงแบบสดGenerateRtspStream
ExtendRtspStream
StopRtspStream
GenerateWebRtcStream
ExtendWebRtcStream
StopWebRtcStream
CameraMotionลักษณะนี้เป็นของทุกอุปกรณ์ที่รองรับเหตุการณ์การตรวจจับการเคลื่อนไหวการเคลื่อนไหว
CameraPersonลักษณะนี้เป็นของอุปกรณ์ที่รองรับเหตุการณ์การตรวจจับคนบุคคล
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 กล้องตรวจพบการเคลื่อนไหว
เหตุการณ์ เหตุการณ์ Person ของลักษณะ CameraPerson กล้องตรวจพบบุคคล
เหตุการณ์ เหตุการณ์เสียงของฟีเจอร์ CameraSound กล้องตรวจพบเสียง
ดูตัวอย่างต่อไปนี้ที่กล้องตรวจพบการเคลื่อนไหว

เพย์โหลด

{
  "eventId" : "6367d154-3e99-4cf7-8903-091465f06ac1",
"timestamp" : "2019-01-01T00:00:01Z",
"resourceUpdate" : { "name" : "enterprises/project-id/devices/device-id", "events" : { "sdm.devices.events.CameraMotion.Motion" : { "eventSessionId" : "CjY5Y3VKaTZwR3o4Y19YbTVfMF...", "eventId" : "RDX2ZaseAwql7vapISCaBQgX7S...", } } } "userId" : "AVPHwEuBfnPOnTqzVFT4IONX2Qqhu9EJ4ubO-bNnQ-yi",
"resourceGroup" : [ "enterprises/project-id/devices/device-id" ] }
เพย์โหลดของเหตุการณ์นี้มี eventId ที่ใช้กับคำสั่ง GenerateImage ได้ คำสั่งนี้จะแสดง URL การดาวน์โหลดสำหรับรูปภาพจากกล้องที่เกี่ยวข้องกับเหตุการณ์ ดังนี้

ส่งคำขอ

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

คำตอบ

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

ดาวน์โหลดรูปภาพจากกล้อง

เรียก GET ไปยัง url จากการตอบสนองด้วยคำสั่ง GenerateImage โดยใช้ token ในส่วนหัวการให้สิทธิ์ HTTP ที่มีการให้สิทธิ์พื้นฐานเพื่อดาวน์โหลดอิมเมจกล้องถ่ายรูป:

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

ใช้พารามิเตอร์การค้นหา width หรือ height เพื่อปรับแต่งความละเอียดของรูปภาพที่ดาวน์โหลด ต้องระบุพารามิเตอร์เหล่านี้เพียงรายการเดียว พารามิเตอร์อื่นจะปรับสัดส่วนโดยอัตโนมัติตามสัดส่วนภาพของกล้อง

ตัวอย่างเช่น หากสัดส่วนภาพของกล้องคือ 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 ดาวน์โหลดดังนี้

  • หากระบุพารามิเตอร์ทั้ง 2 รายการใน URL ระบบจะใช้ width และจะละเว้น height
  • หากไม่มีพารามิเตอร์ใดเลยใน URL ระบบจะเลือกค่าเริ่มต้น 480 สำหรับ width

ดูฟีเจอร์ รูปภาพจากกล้อง เพื่อดูข้อมูลเกี่ยวกับคุณสมบัติของรูปภาพ

เข้าถึงสตรีมแบบสด

คุณเข้าถึงสตรีมแบบสดจากกล้องได้ อุปกรณ์นี้รองรับรูปแบบสตรีมต่อไปนี้

  • RTSP
  • WebRTC

ดูรายการกล้องทั้งหมดและรูปแบบสตรีมที่รองรับได้ที่อุปกรณ์ที่รองรับ

หากต้องการเข้าถึงสตรีมแบบสด ให้ใช้คำสั่งสร้างFormatสตรีม ที่เหมาะสมของลักษณะ cameraLiveStream

WebRTC


สำหรับสตรีม WebRTC ให้ส่ง offerSdp ในคำสั่ง GenerateWebRtcStream ของลักษณะ CameraLiveStream เพื่อรับ 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" : "J9qT75y51GonIuFZHFOmS2GuvA..."
  }
}

เราขอแนะนำให้ใช้ตัวอย่างเว็บแอปพลิเคชันเพื่อเรียนรู้วิธีสร้างสตรีมแบบสดที่ประสบความสำเร็จ ตัวอย่างนี้สร้าง offerSdp ที่ถูกต้องซึ่งเป็นไปตามข้อจำกัดของข้อเสนอ SDP ทั้งหมดสำหรับกล้อง Nest

ข้อเสนอ SDP สำหรับกล้อง Nest ต้องเป็นไปตามข้อจำกัดต่อไปนี้

  • ระบบรองรับเฉพาะรูปแบบแบบรวมเท่านั้น ไม่รองรับแพ็กเกจ B
  • บรรทัดสื่อทั้งหมด (m=) ต้องแสดงในข้อเสนอและต้องเรียงตามลำดับต่อไปนี้
    1. เสียง
    2. วิดีโอ
    3. แอปพลิเคชัน
  • ระบบรองรับ Trickle ICE แต่ไม่บังคับ
  • เฉพาะตัวแปลงรหัส Opus เท่านั้นที่รองรับเสียง
  • ต้องตั้งค่าเสียงเป็น a=recvonly (รับเท่านั้น)
  • ข้อเสนอต้องลงท้ายด้วยอักขระขึ้นบรรทัดใหม่เป็น \r\n หรือ \n

คุณต้องใช้ answerSdp เพื่อสร้างสตรีมแบบสดภายใน 30 วินาทีหลังจากได้รับการตอบกลับ มิฉะนั้นสตรีมแบบสดจะหมดอายุ หาก URL หมดอายุ ให้เรียกใช้คำสั่ง 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

RTSP

สำหรับสตรีม RTSP คำสั่ง GenerateRtspStream ของคำสั่งลักษณะ CameraLiveStream จะแสดง 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

คุณจะแชร์ URL ของสตรีมแบบสด RTSP ระหว่างไคลเอ็นต์ไม่ได้ ไคลเอ็นต์จะใช้ URL ของสตรีมได้ทีละ 1 รายการเท่านั้น หากลูกค้าต้องการสตรีมจากกล้องเดียวกันพร้อมกันหลายราย คุณต้องส่งคำสั่ง RTSP สำหรับลูกค้าแต่ละราย และไคลเอ็นต์แต่ละรายต้องใช้ URL สตรีมของตนเอง

ขยายสตรีมแบบสด

เซสชันสตรีมแบบสดของกล้องจะใช้ได้ 5 นาทีเท่านั้น หากต้องการยืดอายุการใช้งานของสตรีมแบบสด ให้ใช้คำสั่ง "ขยายFormatสตรีม" ที่เหมาะสมของลักษณะ cameraLiveStream สำหรับรูปแบบสตรีมที่สร้างขึ้น

WebRTC


  ใช้สาย   

สตรีม WebRTC ขยายได้ในกล้องแบบใช้สายเท่านั้น กล้องที่ใช้พลังงานจากแบตเตอรี่จะถือว่าใช้สายไฟขณะเสียบปลั๊กเพื่อชาร์จ หากกล้องใช้พลังงานจากแบตเตอรี่ ระบบจะไม่สนใจคำขอขยายสตรีม WebRTC ที่มีการใช้งานอยู่

หากต้องการขยายสตรีม WebRTC ให้ระบุรหัสเซสชันสื่อของสตรีมด้วยคำสั่ง ExtendWebRtcStream ของลักษณะ CameraLiveStream

ส่งคำขอ

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

คำตอบ

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

RTSP

หากต้องการขยายสตรีม RTSP ให้ใช้คำสั่ง ExtendRtspStream ของคำสั่งลักษณะ CameraLiveStream เพื่อรับค่า 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

หยุดสตรีมแบบสด

เมื่อใดก็ตามที่คุณไม่ใช้กล้องสตรีมแบบสดแล้ว คุณควรหยุดสตรีมและปิดใช้งานสตรีม โดยใช้คำสั่ง StopFormatStream ที่เหมาะสมของลักษณะ cameraLiveStream สำหรับรูปแบบสตรีมที่คุณสร้างขึ้น

WebRTC


หากต้องการหยุดสตรีม WebRTC ให้ระบุรหัสเซสชันสื่อด้วยคำสั่ง StopWebRtcStream ของลักษณะ CameraLiveStream

ส่งคำขอ

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

คำตอบ

{}

RTSP

หากต้องการหยุดสตรีม RTSP ให้ใช้โทเค็นเพื่อทำให้เป็นโมฆะด้วยคำสั่ง StopRtspStream ของคำสั่งลักษณะ CameraLiveStream

ส่งคำขอ

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

คำตอบ

{}

ข้อผิดพลาด

ระบบอาจส่งคืนรหัสข้อผิดพลาดต่อไปนี้ที่เกี่ยวข้องกับอุปกรณ์นี้:

ข้อความแสดงข้อผิดพลาด RPC การแก้ปัญหา
กล้องไม่พร้อมให้สตรีม FAILED_PRECONDITION กล้องออฟไลน์อยู่หรือสตรีมไม่ได้เนื่องจากปัญหาทางเทคนิค
ไม่รองรับคำสั่ง INVALID_ARGUMENT ใช้คำสั่งสตรีมแบบสด RTSP สำหรับกล้องที่รองรับ WebRTC หรือใช้คำสั่งสตรีมแบบสด WebRTC สำหรับกล้องที่รองรับ RTSP
รูปภาพจากกล้องไม่พร้อมให้ดาวน์โหลดแล้ว DEADLINE_EXCEEDED รูปภาพกิจกรรมจะหมดอายุใน 30 วินาทีหลังจากเผยแพร่ โปรดดาวน์โหลดรูปภาพก่อนหมดอายุ
รหัสเหตุการณ์ไม่ได้อยู่ในกล้อง FAILED_PRECONDITION ใช้ eventID ที่ถูกต้องซึ่งแสดงผลจากเหตุการณ์จากกล้อง

ดูข้อมูลอ้างอิงรหัสข้อผิดพลาดของ API สำหรับรายการรหัสข้อผิดพลาดทั้งหมดของ API