I want to use Kurento primarily as a WebRTC to RTP gateway and for some of the filters. In the browser, I am using the browser's native WebRTC API.
I want to create a WebRTCEndpoint (as that term is used in Kurento) in my Node application server and connect it to a RTPEndpoint (as that term is used in Kurento) via a Kurento pipeline. I know that this is trival in Kurento but my question is, is it possible to do so by only using Kurento-client.js in the app server but WITHOUT USING Kurento-utils.js in the browser? THere are many reasons that I want to do this, one of them is that I have my own signalling and there are other issues where I need direct control over the low-level WebRTC API in the browser, something that kurento-utils.js does not allow me to do.
I also believe that to be tied to ws for signalling without having a fallback is not an ideal design, if indeed that is what Kurento is enforcing.
Sure! Kurento-utils-js
is just an RTCPeerConnection
wrapper, to manage the video tags, buffering ICE candidates, mangling of SDPs in case of PlanB or UnifiedPlan and a couple more things. The library does not have any ties with a special signaling: The callbacks from the methods that you would put the signaling in, are the same for both RTCPeerConnection
and WebRtcPeer
objects. For instance, this is how you would, create a WebRtcPeer
, and how you would send an SDP offer generated by it
var options = {
onicecandidate : onIceCandidate,
localVideo : localMedia,
remoteVideo : remoteMedia
}
var webRtcPeer = new kurentoUtils.WebRtcPeer.WebRtcPeerSendrecv(options, function(error) {
if (error) return console.error(error)
webRtcPeer.generateOffer(function (error, sdpOffer) {
if (error) return console.error(error)
sendMessageToServerApp("sdpOfferMessage", sdpOffer)
})
})
sendMessageToServerApp
is something that you need to implement.
You can also access the wrapped object. Assuming you have a webRtcPeer
object from the library, you can get the RTCPeerConnection
with the property webRtcPeer.peerConnection
.
The purpose of using websockets is to support events going from the media server to the proxy elements defined in your server app. Though you can go with things like long polling and other tricks, it is not likely that you are going to deploy your server app and your KMS in environments where you would need them, as you should have full control of that part. The suggestion is to have the signaling port of the media server only available to your server application.
For having a fallback mechanism between client and server app, I'd suggest SockJS for instance. We've used that in the past and it works fine.