Reputation: 21
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?
Upvotes: 0
Views: 613
Reputation: 21
I have used this online tool and got the offer in the console.
The following offer was generated:
a=rtcp-mux
a=rtcp-rsize
a=rtpmap:120 VP8/90000
a=rtpmap:124 rtx/90000
a=rtpmap:121 VP9/90000
a=rtpmap:125 rtx/90000
a=rtpmap:126 H264/90000
a=rtpmap:127 rtx/90000
a=rtpmap:97 H264/90000
a=rtpmap:98 rtx/90000
a=setup:actpass
a=ssrc:3270553860 cname:{6d4a9509-da38-4be5-b6c0-e1b61b24de50}
m=application 9 UDP/DTLS/SCTP webrtc-datachannel
c=IN IP4 0.0.0.0
a=sendrecv
a=ice-pwd:df7be166f74ae8480f36d9b634908922
a=ice-ufrag:da4e0cc3
a=mid:2
a=setup:actpass
a=sctp-port:5000
a=max-message-size:1073741823
Upvotes: 1