Does Kurento-utils WebRtcPeerSendrecv pay attention to all options?

1.7k views Asked by At

I'm using WebRtcPeerSendrecv object to build a communication with WebRTC endpoint with kurento server. I want to select a video input as it is made here: https://webrtc.github.io/samples/src/content/devices/input-output/

The problem I have is that adding a property video/deviceId is not working.

options = {
    audio : false,
    localVideo : videoInput,
    remoteVideo : videoOutput,
    video: {
        deviceId: {exact: devcs[0]}
        },
    onicecandidate : onIceCandidate,
    onerror : onError
}

The only thing which is made in other way, is that I'm building my WebRtc connection with WebRtcPeerSendrecv from Kurento-utils, and originally it is made with using navigator.getUserMedia(...). As far as I know, WebRtcPeerSendrecv is calling getUserMedia, but I'm not sure that all properties are copied one to one. I took a look here for source code of https://github.com/Kurento/kurento-utils-js/blob/master/lib/WebRtcPeer.js but I'm not sure of it. Have anyone faced with a simmilar problem?

Edit:

There is wider sourcecode which is containing a webRTCPeer creation (with tetsting another options):

var options;
    console.log(devcs);
    if(devcs.length == 2){
        console.log("CAMERA ID SET");
        options = {
            audio : false,
            localVideo : videoInput,
            remoteVideo : videoOutput,
            video: {
                optional: [{sourceId: devcs[0]}]
                //deviceId: {exact: devcs[0]}
            },
            onicecandidate : onIceCandidate,
            onerror : onError
        }
    }
    else{
        console.log("THERE ARE NO 2 CAMERAS");
        options = {
                audio : false,
                localVideo : videoInput,
                remoteVideo : videoOutput,
                onicecandidate : onIceCandidate,
                onerror : onError
            }
    }
    webRtcPeer = new kurentoUtils.WebRtcPeer.WebRtcPeerSendrecv(options,
            function(error) {
                if (error) {
                    return console.error(error);
                }
                webRtcPeer.generateOffer(onOfferIncomingCall);
            });

I have tried with both options with both IDs which I'm getting in a devcs array, and both are not working- I have always a front camera. As I checked, the devcs contains IDs. There is way in which I obtain them.

There are some log, but not too much (log from android- I'm building it in WebView (chromium)):

12-21 12:21:39.985 25173-25173/eu.kros.t_medapp I/chromium: [INFO:CONSOLE(70)] "Received message: {"id":"incomingCall","from":"Qwe"}", source: https://192.168.137.1:8443/tmedserver/resources/demo-console/js/index.js (70) 12-21 12:21:42.374 25173-25173/eu.kros.t_medapp I/chromium: [INFO:CONSOLE(70)] "1a8c3f3af9469f0c9e89adf8324f03cc9300abee4a283499cfc0bc5161d0bd7b,8fb6f256ea855f26c5d3f6c02048a83472839e33f9b36f0f5af03750f0ea0693", source: https://192.168.137.1:8443/tmedserver/resources/demo-console/js/index.js (70) 12-21 12:21:42.376 25173-25173/eu.kros.t_medapp I/chromium: [INFO:CONSOLE(70)] "CAMERA ID SET", source: https://192.168.137.1:8443/tmedserver/resources/demo-console/js/index.js (70) 12-21 12:21:42.580 25173-25173/eu.kros.t_medapp I/chromium: [INFO:CONSOLE(274)] "constraints: {"mandatory":{"OfferToReceiveAudio":true,"OfferToReceiveVideo":true},"optional":[{"DtlsSrtpKeyAgreement":true}]}", source: https://192.168.137.1:8443/tmedserver/resources/kurento-utils/kurento-utils.js (274) 12-21 12:21:42.582 25173-25460/eu.kros.t_medapp W/chromium: [WARNING:mediasession.cc(350)] Duplicate id found. Reassigning from 101 to 127 12-21 12:21:42.674 25173-25461/eu.kros.t_medapp E/chromium: [ERROR:voe_audio_processing_impl.cc(774)] SetTypingDetectionStatus: not supported 12-21 12:21:42.675 25173-25461/eu.kros.t_medapp W/chromium: [WARNING:webrtcvoiceengine.cc(820)] SetTypingDetectionStatus(0) failed, err=8003 12-21 12:21:42.683 25173-25461/eu.kros.t_medapp E/chromium: [ERROR:voe_audio_processing_impl.cc(774)] SetTypingDetectionStatus: not supported 12-21 12:21:42.684 25173-25461/eu.kros.t_medapp W/chromium: [WARNING:webrtcvoiceengine.cc(820)] SetTypingDetectionStatus(0) failed, err=8003 12-21 12:21:42.697 25173-25173/eu.kros.t_medapp I/chromium: [INFO:CONSOLE(276)] "Created SDP offer", source: https://192.168.137.1:8443/tmedserver/resources/kurento-utils/kurento-utils.js (276) 12-21 12:21:42.737 25173-25173/eu.kros.t_medapp I/chromium: [INFO:CONSOLE(281)] "Local description set", source: https://192.168.137.1:8443/tmedserver/resources/kurento-utils/kurento-utils.js (281) 12-21 12:21:42.742 25173-25173/eu.kros.t_medapp I/chromium: [INFO:CONSOLE(70)] "Senging message: {"id":"incomingCallResponse","from":"Qwe","callResponse":"accept","sdpOffer":"v=0\r\no=- 5220787002804162488 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE audio video\r\na=msid-semantic: WMS 3Rq4qyKWshfM1wF6rXu3OZ0sNxq7Fus0qJUx\r\nm=audio 9 UDP/TLS/RTP/SAVPF 111 103 9 0 8 105 13 126\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:wXPX\r\na=ice-pwd:VXRwTn0RLvzpFqC3uk58oanh\r\na=fingerprint:sha-256 FC:85:C8:8A:29:71:CB:7D:DE:02:EE:47:1A:5A:0B:E2:EE:FD:58:5B:2D:F1:65:A6:DC:2B:34:5E:E7:25:5A:12\r\na=setup:actpass\r\na=mid:audio\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=sendrecv\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:103 ISAC/16000\r\na=rtpmap:9 G722/8000\r\na=rtpmap:0 PCMU/8000\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:105 CN/16000\r\na=rtpmap:13 CN/8000\r\na=rtpmap:126 telephone-event/8000\r\na=ssrc:854056653 cname:0AmhreG6mVDgfHOl\r\na=ssrc:854056653 msid:3Rq4qyKWshfM1wF6rXu3OZ0sNxq7Fus0qJUx 71667887-1f6b-475d-8c80-4fbd58f5ce3c\r\na=ssrc:854056653 mslabel:3Rq4qyKWshfM1wF6rXu3OZ0sNxq7Fus0qJUx\r\na=ssrc:854056653 label:71667887-1f6b-475d-8c80-4fbd58f5ce3c\r\nm=video 9 UDP/TLS/RTP/SAVPF 100 101 116 117 96 97 98\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:wXPX\r\na=ice-pwd:VXRwTn0RLvzpFqC3uk58oanh\r\na=fingerprint:sha-256 FC:85:C8:8A:29:71:CB:7D:DE:02:EE:47:1A:5A:0B:E2:EE:FD:58:5B:2D:F1:65:A6:DC:2B:34:5E:E7:25:5A:12\r\na=setup:actpass\r\na=mid:video\r\na=extmap:2 urn:ietf:params:rtp-hdrext:toffset\r\na=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=extmap:4 urn:3gpp:video-orientation\r\na=extmap:5 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=extmap:6 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay\r\na=sendrecv\r\na=rtcp-mux\r\na=rtcp-rsize\r\na=rtpmap:100 VP8/90000\r\na=rtcp-fb:100 ccm fir\r\na=rtcp-fb:100 nack\r\na=rtcp-fb:100 nack pli\r\na=rtcp-fb:100 goog-remb\r\na=rtcp-fb:100 transport-cc\r\na=rtpmap:101 VP9/90000\r\na=rtcp-fb:101 ccm fir\r\na=rtcp-fb:101 nack\r\na=rtcp-fb:101 nack pli\r\na=rtcp-fb:101 goog-remb\r\na=rtcp-fb:101 transport-cc\r\na=rtpmap:116 red/90000\r\na=rtpmap:117 ulpfec/90000\r\na=rtpmap:96 rtx/90000\r\na=fmtp:96 apt=100\r\na=rtpmap:97 rtx/90000\r\na=fmtp:97 apt=101\r\na=rtpmap:98 rtx/90000\r\na=fmtp:98 apt=116\r\na=ssrc-group:FID 2811430131 2273108000\r\na=ssrc:2811430131 cname:0AmhreG6mVDgfHOl\r\na=ssrc:2811430131 msid:3Rq4qyKWshfM1wF6rXu3OZ0sNxq7Fus0qJUx d9810401-c8be-4f49-9453-35646b1842d0\r\na=ssrc:2811430131 mslabel:3Rq4qyKWshfM1wF6rXu3OZ0sNxq7Fus0qJUx\r\na=ssrc:2811430131 label:d9810401-c8be-4f49-9453-35646b1842d0\r\na=ssrc:2273108000 cname:0AmhreG6mVDgfHOl\r\na=ssrc:2273108000 msid:3Rq4qyKWshfM1wF6rXu3OZ0sNxq7Fus0qJUx d9810401-c8be-4f49-9453-35646b1842d0\r\na=ssrc:2273108000 mslabel:3Rq4qyKWshfM1wF6rXu3OZ0sNxq7Fus0qJUx\r\na=ssrc:2273108000 label:d9810401-c8be-4f49-9453-35646b1842d0\r\n"}", source: https://192.168.137.1:8443/tmedserver/resources/demo-console/js/index.js (70)

1

There are 1 answers

0
Krystian On BEST ANSWER

The solution is not connected with kurento client. Video properties must be added through a mediaConstraint option:

var constraints = {
                audio:true,
                video:{
                    deviceId: {exact: devcs[1]}
                }
        };
        options = {
            audio : false,
            localVideo : videoInput,
            remoteVideo : videoOutput,
            mediaConstraints:constraints,
            onicecandidate : onIceCandidate,
            onerror : onError
        }

The other problem which I'm facing right now is that camera is working well with only one video id : with devcs[0]. Whith second camera (devcs[1]) there is black video element and error in logs:

12-21 13:09:12.562 9704-9757/eu.kros.t_medapp W/CameraBase: An error occurred while connecting to camera: 0

12-21 13:09:12.5629704-9757/eu.kros.t_medapp E/cr_VideoCapture: allocate: Camera.open: java.lang.RuntimeException: Fail to connect to camera service

12-21 13:09:12.568 9704-9757/eu.kros.t_medapp E/cr_VideoCapture: stopCapture: mCamera is null

When I will solve it I will update this post.