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)
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.
Related
I am using react-native-webrtc to implement livestreaming
React native version: 0.66.4,
react native webrtc version:^1.94.2
I have 2 separate screens for the person who creates the livestream and people who join on the stream and on both sides I am creating an instance of RTCPeerConnection (outside the body of the screen component) as follows:
const configuration = {iceServers: [{url: 'stun:stun.l.google.com:19302'}]};
const pc = new RTCPeerConnection(configuration);
I have this other function for creating offer:
const createOffer = async () => {
const offer = await pc.createOffer();
offerRef.current = offer;
// await pc.setLocalDescription(offer);
}
For the moment I commented out the pc.setLocalDescription because it's throwing an error:PeerConnection not found
This is what the offer looks:
{"sdp": "v=0 o=- 4201814093591570700 2 IN IP4 127.0.0.1 s=- t=0 0 a=extmap-allow-mixed a=msid-semantic: WMS", "type": "offer"}
then through the signaling server I am sending this offer to the other peer who is trying to join the streaming and on his side I am trying to do :
pc.setRemoteDescription(offer)
but it is giving me error
{
"message": "SessionDescription is NULL.",
"name": "SetRemoteDescriptionFailed",
}
Any idea why is this happening I checked the offer on both sides and they are identical and also I don't understand why I am getting that PeerConnection is NULL error could that be causing all this?
Note: The pc instance on the person who creates the live stream and the person who is trying to join the stream is not the same they are both declared same way tho with the same configuration.
don't work example in safari
https://github.com/Kurento/kurento-tutorial-node/tree/master/kurento-one2many-call
In chrome, everything is fine.
Safary does not send ice candidates in view mode. Presenter mode is ok
====================
update
In the Front (index.js)
The event onOfferViewer is always executed
onIceCandidate – never executed
Connection from Front to the node
var ws = new WebSocket('wss://' + location.host + '/one2many');
On KMS a Turn doesn’t turn on, but a Stun is configured. I can broadcasting from Safari, but I cannot watching on it
Look at kurento utils deeper
2 Sturm servers are chosen, before WebRtcPeer initialization
iceServers: Array (2)
0 {username: undefined, credential: undefined, url: "stun:stun.l.google.com:19302", urls: ["stun:stun.l.google.com:19302"]}
1 {username: undefined, credential: undefined, url: "stun:stun.voipbuster.com", urls: ["stun:stun.voipbuster.com"]}
After RTCPeerConnection is created
After Process answer is executed
I think the next step has to be in a function addEventListener
pc.addEventListener('icecandidate', function (event) {…}
In Chrome in the function addEventListener a callback is executed but for Safari never.
I can assume that the candidates come before the subscription is taking place, but there is no evidence, and I don’t understand why the presenter works fine.
detail
I started broadcasting in the presenter mode in the Safari
The Safari version - 13604.3.5 (MacOs - 11.0.1)
The Safari options
Old api - Enabled
Ice restrictions - Disabled
The Bower’s dependencies
"dependencies": {
"adapter.js": "v0.2.9",
"bootstrap": "~3.3.0",
"ekko-lightbox": "~3.3.0",
"demo-console": "1.5.1",
"kurento-utils": "master"
}
The package.json structure
{
"name": "kurento-one2many-call",
"version": "6.7.3-dev",
"private": true,
"scripts": {
"postinstall": "cd static && bower install"
},
"dependencies": {
"express": "~4.12.4",
"minimist": "^1.1.1",
"ws": "~1.0.1",
"kurento-client": "Kurento/kurento-client-js"
},
"devDependencies": {
"bower": "^1.4.1"
}
}
Output of Safari logs
Output of Safari logs
[Log] Browser does not appear to be WebRTC-capable (adapter.js, line 34)
[Debug] constraints: {"offerToReceiveAudio":true,"offerToReceiveVideo":true} (kurento-utils.js, line 268)
[Debug] Created SDP offer (kurento-utils.js, line 270)
[Debug] Local description set – "v=0
↵o=- 5811275597248577793 2 IN IP4 127.0.0.1
↵s=-
↵t=0 0
↵a=msid-semantic: WMS
↵" (kurento-utils.js, line 275)
"v=0
o=- 5811275597248577793 2 IN IP4 127.0.0.1
s=-
t=0 0
a=msid-semantic: WMS
"
[Log] Senging message: {"id":"viewer","sdpOffer":"v=0\r\no=- 5811275597248577793 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=msid-semantic: WMS\r\n"} (index.js, line 70)
[Info] Received message: {"id":"viewerResponse","response":"accepted","sdpAnswer":"v=0\r\no=- 3748169328 3748169328 IN IP4 0.0.0.0\r\ns=Kurento Media Server\r\nc=IN IP4 0.0.0.0\r\nt=0 0\r\na=msid-semantic: WMS\r\n"} (index.js, line 70)
[Debug] SDP answer received, setting remote description (kurento-utils.js, line 320)
[Debug] Remote stream: – undefined (kurento-utils.js, line 294)
How to a node connects to KMS
var argv = minimist(process.argv.slice(2), {
default: {
as_uri: 'https://localhost:8443/',
ws_uri: 'ws://37.228.89.170:8888/kurento'
}
});
Two options:
Safari 12 only - Need to enable the experimental feature "Enable MDNS Ice Candidates" in Safari settings, advanced, experimental features
Safari 11 - you have to call getUserMedia({video: true, audio: true}), and have the user accept the dialog box to allow video and audio on your page. Even though you don't want to use the video or audio, this then causes safari to send ice-candidates during the negotiation
This question is vague and does not provide a lot of detail. Please provide more details on the issue you are experiencing and what you have done to try to fix it/debug it.
You might try to disable the ICE candidate restrictions option in the developer menu and restart Safari, as mentioned in this Google Group post. Without knowing more information, I can't help much more than this.
For the future, please provide more thorough and detailed information on the problem and solutions you have attempted.
WEBRTC - while setting answer into setLocalDescription getting below error in firefox beta version .63
this.soc.setLocalDescription(answer, function(){}, function(error){ co.handleAnswerLoacalDescError(error); } );
SWRTCAnswerPConn.prototype.handleAnswerLoacalDescError = function (error) {
console.log("error SWRTCAnswerPConn.prototype.handleAnswerLoacalDescError "+error);
}
Below one is the local sdp
"v=0\r\no=mozilla...THIS_IS_SDPARTA-63.0 6779639364423913043 0 IN IP4 0.0.0.0\r\ns=-\r\nt=0 0\r\n
a=ice-options:trickle\r\n
a=msid-semantic:WMS *\r\nm=audio 9 RTP/SAVPF 0\r\nc=IN IP4 0.0.0.0\r\n
a=sendrecv\r\n
a=ice-pwd:0c25b6011567fa002a87fw6d36d0c32e\r\n
a=ice-ufrag:9cba9881\r\n
a=msid:{342671bf-c92f-4d7e-add6-37228fcaffc4} {6876af26-691b-4beb-9fed-a18e27ea0fe0}\r\n
a=rtcp-mux\r\n
a=rtpmap:0 PCMU/8000\r\n
a=setup:active\r\n
a=ssrc:127692948 cname:{f7d3d74d-86e0-4a27-a143-79f4703d32cf}\r\n"
*
InvalidSessionDescriptionError: Local descriptions must have a=mid attributes
*
Please, anyone, help to resolve this issue.
When the request to the worklight server from the Mobile device times-out, I get the following Error and it looks like it is being pushed from the Worklight framework
http://serveraddress:portno/console/apps/services/api/app_title...
Make sure the host address is available to the app (especially relevant for android and iphone apps
Now It's not ideal to reveal the server address to the end user. And I'm not able to figure out as to where this can be customized. Need suggestion on how to modify this error Message
AFSIK Try Change the log level from your wlInitOptions to error and check the logs to disable the timeout error messages
`var wlInitOptions = {
connectOnStartup : true,
timeout : 60000,
logger : {enabled: true, level: 'error', stringify: true, pretty: false,
tag: {level: false, pkg: true}, whitelist: [], blacklist: []},
analytics : {
enabled: false
}
};`
I have enabled the nativeOptions: {capture: true} in initOptions.js
logger : {enabled: true, level: 'debug', stringify: true, pretty: false,
tag: {level: false, pkg: true}, whitelist: [], blacklist: [], nativeOptions: {capture: true}}
In my main js file i have the following code.
function wlCommonInit(){
// Common initialization code goes here
WL.Logger.setNativeOptions({'capture': true});
var logger = WL.Logger.create({pkg: 'mypackage'});
logger.debug('Hello world - debug');
//[mypackage] Hello world
logger.log('Hello world - log');
//[mypackage] Hello world
logger.info('Hello world - info');
//[mypackage] Hello world
logger.warn('Hello world - warn');
//[mypackage] Hello world
logger.error('Hello world - error');
//[mypackage] Hello world
WL.Logger.send(); }
WL.Logger.send() suppose to call my adapter "WLClientLogReceiver". But i am not getting any call for this adapter.
Please let me know, i need to enable any other settings to upload my client side captured log to server.
function log(deviceInfo, logMessages) {
return true;}
<procedure name="log" securityTest="wl_unprotected" audit="true" />
logger : {enabled: true, level: 'debug', stringify: true, pretty: false, tag: {level: false, pkg: true}, whitelist: [], blacklist: [], nativeOptions: {capture: true}}
You have enabled the native capture as true in initOptions.js so no need to set it again.
You can log using your package that will help you in filtering the messages based on the package in your WLClientLogReceiver adapter.
var myloggerObject = WL.Logger.create({pkg: 'mypackage'});
myloggerObject.debug("Hello world");
you can specify your level in your js file to be logged in client device.
In the adapter you will get the log messages as an json array.
function log(deviceInfo, logMessages) {
/* The adapter can choose to process the parameters,
for example to forward them to a backend server for
safekeeping and further analysis.
The deviceInfo object may look like this:
{
"appName": "wlapp",
"appVersion": "1.0",
"deviceId": "66eed0c9-ecf7-355f-914a-3cedac70ebcc",
"model": "Galaxy Nexus - 4.2.2 - API 17 - 720x1280",
"systemName": "Android",
"systemVersion": "4.2.2",
"os.arch": "i686", // Android only
"os.version": "3.4.0-qemu+" // Android only
}
The logMessages parameter is a JSON array
that contains JSON object elements, and might look like this:
[{
"timestamp" : "17-02-2013 13:54:23:745", // "dd-MM-yyyy hh:mm:ss:S"
"level" : "ERROR", // ERROR||WARN||INFO||LOG|| DEBUG
"package" : "your_tag", // typically a class name
"msg" : "the message", // a helpful log message
"threadid" : 42, // (Android only)the current thread
"metadata" : { "$src" : "js" } // metadata placed on the log call
}]
*/
//sample log and filtering method
var logs= [{
"timestamp" : "17-02-2013 13:54:23:745", // "dd-MM-yyyy hh:mm:ss:S"
"level" : "ERROR", // ERROR||WARN||INFO||LOG|| DEBUG
"package" : "your_tag", // typically a class name
"msg" : "the message", // a helpful log message
"threadid" : 42, // (Android only)the current thread
"metadata" : { "$src" : "js" } // metadata placed on the log call
},
{
"timestamp" : "17-02-2013 13:54:23:745", // "dd-MM-yyyy hh:mm:ss:S"
"level" : "ERROR", // ERROR||WARN||INFO||LOG|| DEBUG
"package" : "mypackage", // typically a class name
"msg" : "my package message", // a helpful log message
"threadid" : 42, // (Android only)the current thread
"metadata" : { "$src" : "js" } // metadata placed on the log call
}
];
var filteredLogs = logs.filter(function(log){
if(log.package == mypackage) //comparing the package and returns the object
{ return log; }
});
WL.Logger.error(filteredLogs);// This is send only the filtered array to your server
}
If you log using metadata such as filename along with the debug message you will get those in the array in metadata attribute.
It is suggested to stringify and parse the object to avoid errors before parsing the device logs in the adapter.
var logs = JSON.stringify(JSON.parse(logs));
var filteredLogs = logs.filter ...
Hope this will work for you.
Make sure you test it using the device.
The send function is not attached to the LogInstance prototype, which is what you're using when you use a logger instance created with WL.Logger.create(). Please call
WL.Logger.send();
instead.
(Above was posted prior to OP's edit.)
Since setNativeOptions is an asynchronous call (it calls down through a Cordova plugin), it is possible it has not successfully turned capture on prior to completion of the subsequent logger calls. So at the time of the call to WL.Logger.send(); nothing has been collected yet.
Do this:
function wlCommonInit() {
// Common initialization code goes here
WL.Logger.setNativeOptions({'capture': true})
.then(function() {
var logger = WL.Logger.create({pkg: 'mypackage'});
logger.debug('Hello world - debug');
//[mypackage] Hello world
logger.log('Hello world - log');
//[mypackage] Hello world
logger.info('Hello world - info');
//[mypackage] Hello world
logger.warn('Hello world - warn');
//[mypackage] Hello world
logger.error('Hello world - error');
//[mypackage] Hello world
WL.Logger.send();
});
}
Be sure to check the server-side logs. The audit="true" in the adapter's descriptor file will print the parameters passed to the adapter inline in the server logs (messages.log on WebSphere Liberty).