我使用WebRtcPeerSendrecv对象与kurento服务器建立与WebRTC端点的通信。我想在此处选择视频输入:https://webrtc.github.io/samples/src/content/devices/input-output/
我遇到的问题是添加属性video / deviceId无效。
options = {
audio : false,
localVideo : videoInput,
remoteVideo : videoOutput,
video: {
deviceId: {exact: devcs[0]}
},
onicecandidate : onIceCandidate,
onerror : onError
}
唯一以其他方式制作的是我从Kurento-utils构建与WebRtcPeerSendrecv的WebRtc连接,最初是使用navigator.getUserMedia(...)制作的。 据我所知,WebRtcPeerSendrecv正在调用getUserMedia,但我不确定所有属性是一对一复制的。我在这里查看了https://github.com/Kurento/kurento-utils-js/blob/master/lib/WebRtcPeer.js的源代码,但我不确定。有没有人面临同样的问题?
修改
有更广泛的源代码,其中包含webRTCPeer创建(使用tetsting其他选项):
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);
});
我已尝试使用这两个ID,我在devcs数组中获取这两个ID,两者都没有工作 - 我总是使用前置摄像头。在我检查时,devcs包含ID。我有办法获得它们。
有一些日志,但不是太多(记录来自android-我在WebView(铬)中构建它):
12-21 12:21:39.985 25173-25173 / eu.kros.t_medapp I / chromium: [INFO:CONSOLE(70)]"收到消息: {" id":" incomingCall","来自":" Qwe"}",来源: 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:控制台(70)] " 1a8c3f3af9469f0c9e89adf8324f03cc9300abee4a283499cfc0bc5161d0bd7b,8fb6f256ea855f26c5d3f6c02048a83472839e33f9b36f0f5af03750f0ea0693&#34 ;, 资源: 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",来源: 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)]"约束: {"强制性" {" OfferToReceiveAudio":真," OfferToReceiveVideo":真}"可选":[{" DtlsSrtpKeyAgreement& #34;:真}]}&#34 ;, 资源: 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: [警告:mediasession.cc(350)]发现重复的ID。重新分配 101至127 12-21 12:21:42.674 25173-25461 / eu.kros.t_medapp E / chromium: [错误:voe_audio_processing_impl.cc(774)] SetTypingDetectionStatus: 不支持12-21 12:21:42.675 25173-25461 / eu.kros.t_medapp W /铬:[警告:webrtcvoiceengine.cc(820)] SetTypingDetectionStatus(0)失败,错误= 8003 12-21 12:21:42.683 25173-25461 / eu.kros.t_medapp E / chromium: [错误:voe_audio_processing_impl.cc(774)] SetTypingDetectionStatus: 不支持12-21 12:21:42.684 25173-25461 / eu.kros.t_medapp W /铬:[警告:webrtcvoiceengine.cc(820)] SetTypingDetectionStatus(0)失败,错误= 8003 12-21 12:21:42.697 25173-25173 / eu.kros.t_medapp I / chromium:[INFO:CONSOLE(276)]"创建 SDP提供",来源: 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)]"本地描述集",来源: 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消息: {" ID":" incomingCallResponse""从":" QWE"" callResponse":"接受"" sdpOffer":" v = 0 \ r \没有= - 5220787002804162488 2 IN IP4 127.0.0.1 \ r \ ns = - \ r \ nt = 0 0 \ r \ nn =组:BUNDLE音频视频\ r \ nn = 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 \ nn = rtcp:9 IN IP4 0.0.0.0 \ r \ NA =冰冷ufrag:wXPX \ r \ NA =冰冷PWD:VXRwTn0RLvzpFqC3uk58oanh \ r \ NA =指纹: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 =设置:actpass \ r \ NA =中期:音频\ r \ NA = extmap:1 瓮:IETF:PARAMS:RTP-hdrext:SSRC音频级\ 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 \ n = na = rtcp-fb:111 transport-cc \ n \ n \ na = fmtp:111 minptime = 10; useinbandfec = 1 \ r \ nn = rtpmap:103 ISAC / 16000 \ r \ nn = rtpmap:9 G722 / 8000 \ r \ nn = rtpmap:0 PCMU / 8000 \ r \ n = na = rtpmap:8 PCMA / 8000 \ r \ n = na = rtpmap:105 CN / 16000 \ r \ nn = rtpmap:13 CN / 8000 \ r \ nn = rtpmap:126电话事件/ 8000 \ r \ n = 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 标签:71667887-1f6b-475d-8c80-4fbd58f5ce3c \ r \ nm =视频9 UDP / TLS / RTP / SAVPF 100 101 116 117 96 97 98 \ r \ nc = IN IP4 0.0.0.0 \ r \ nn = rtcp:9 IN IP4 0.0.0.0 \ r \ nn = na = ice-ufrag:wXPX \ r \ na = ice-pwd:VXRwTn0RLvzpFqC3uk58oanh \ r \ na =指纹: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 =设置:actpass \ r \ NA =中期:视频\ r \ NA = extmap:2 瓮:IETF:PARAMS:RTP-hdrext:Toffset中\ r \ NA = extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time \ r \ NA = extmap:4 瓮:3GPP:视频取向\ 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 \ n = na = rtcp-fb:100 ccm fir \ r \ n = na = rtcp-fb:100 nack \ r \ n = na = rtcp-fb:100 nack pli \ r \ n na = rtcp-fb:100 goog-remb \ r \ n = na = rtcp-fb:100 transport-cc \ r \ nn :: na = rtpmap:101 VP9 / 90000 \ r \ n = na = rtcp-fb:101 ccm fir \ r \ n = na = rtcp-fb:101 nack \ r \ n = na = rtcp-fb:101 nack pli \ r \ n na = rtcp-fb:101 goog-remb \ r \ n = na = rtcp-fb:101 transport-cc \ r \ nn :: na = rtpmap:116 red / 90000 \ r \ n = na = rtpmap:117 ulpfec / 90000 \ r \ n = na = rtpmap:96 rtx / 90000 \ r \ n = na = fmtp:96 apt = 100 \ r \ n = na = rtpmap:97 rtx / 90000 \ r \ n = na = fmtp:97 apt = 101 \ r \ n = na = rtpmap:98 rtx / 90000 \ r \ n = na = fmtp:98 apt = 116 \ r \ n = na = ssrc-group:FID 2811430131 2273108000 \ r \ n = 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 标签: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 标签:d9810401-c8be-4f49-9453-35646b1842d0 \ r \ n"}",来源: https://192.168.137.1:8443/tmedserver/resources/demo-console/js/index.js (70)
答案 0 :(得分:3)
该解决方案未与kurento客户端连接。 必须通过mediaConstraint选项添加视频属性:
std::is_same
我现在面临的另一个问题是相机只能使用一个视频ID:使用devcs [0]。第二个相机(devcs [1])有黑色视频元素和日志中的错误:
12-21 13:09:12.562 9704-9757 / eu.kros.t_medapp W / CameraBase:错误 连接到相机时发生:0
12-21 13:09:12.5629704-9757 / eu.kros.t_medapp E / cr_VideoCapture:allocate:Camera.open: java.lang.RuntimeException:无法连接到摄像头服务
12-21 13:09:12.568 9704-9757 / eu.kros.t_medapp E / cr_VideoCapture: stopCapture:mCamera为null
当我解决这个问题时,我会更新这篇文章。