【发布时间】:2022-01-18 10:23:02
【问题描述】:
我正在尝试在仅支持 WebRTC 流的 Nest Battery Cam 上执行 sdm.devices.commands.CameraLiveStream.GenerateWebRtcStream 命令。请求应如下所示:
POST /enterprises/$project-id/devices/$device-id:executeCommand
{
"command" : "sdm.devices.commands.CameraLiveStream.GenerateWebRtcStream",
"params" : {
"offerSdp" : "$offerSdp"
}
}
根据另一个已回答的问题,以下代码会生成正确的 SDP 报价,该报价被 Google 接受:
const myPeerConnection = new RTCPeerConnection
myPeerConnection.createDataChannel("dataSendChannel");
myPeerConnection.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0}).then(function(offer) {
return myPeerConnection.setLocalDescription(offer);
})
.then(function() {
console.log(myPeerConnection.localDescription.sdp + "\n");
})
.catch(function(reason) {
console.log("An error occurred, so handle the failure to connect");
});
有谁知道如何从最后一个代码“生成”要插入第一个代码的 $offerSdp?
【问题讨论】: