nest – SDP Offer WebRTC
I’m trying to execute the sdm.devices.commands.CameraLiveStream.GenerateWebRtcStream command on a Nest Battery Cam which only support WebRTC streams. The request should be as follows:
POST /enterprises/$project-id/devices/$device-id:executeCommand
{
"command" : "sdm.devices.commands.CameraLiveStream.GenerateWebRtcStream",
"params" : {
"offerSdp" : "$offerSdp"
}
}
According to another answered question the following code generates a correct SDP offer which is accepted by 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");
});
Has anyone an idea how to “generate” from the last code the $offerSdp to be inserted in the first code?
Read more here: Source link