Safari does not send ice candidates - safari

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.

Related

Why setRemoteDescription on RTCPeerConnection instance is failing with message Session Description is NULL?

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.

[Karate Test][Saucelab]: Session disconnecting after launching mobile app installed in Saucelab

I am launching android test on Saucelab, however I can see the script is launching the mobile app on saucelab but not able to perform any action on it and throwing this exception:
12:54:20.931 [main] ERROR com.intuit.karate - java.net.SocketTimeoutException: Read timed out, http call failed after 32303 milliseconds for url: https://oauth-abdulkadir786-684f1:1bd00f8e-392f-4b4c-8f0e-2597cc9912a3#ondemand.eu-central-1.saucelabs.com:443/wd/hub/session
I am using the following steps for execute my test:
Configure driver in karate-config.js
var android = {}
android["desiredConfig"] = {
"accessKey":"1bd00f8e-392f-4b4c-8f0e-2597cc9912a3",
"deviceName":"Android GoogleAPI Emulator",
"app" : "storage:b82d6099-60ad-49dd-b15f-925166e03dcd",
"platformVersion" : "11.0",
"platformName" : "Android",
"newCommandTimeout":300,
"automationName" : "UiAutomator2",
"username": "oauth-abdulkadir786-684f1"
}
config["android"] = android
Then Writing the feature file to call the webDriverSession:
Feature: Calling test from Sauce labs
Background:
* configure driver = { type: 'android', start: false, webDriverUrl: 'https://oauth-abdulkadir786-684f1:1bd00f8e-392f-4b4c-8f0e-2597cc9912a3#ondemand.eu-central-1.saucelabs.com:443/wd/hub' }
Scenario: android mobile app UI tests
Given driver { webDriverSession: { desiredCapabilities : "#(android.desiredConfig)"} }
* delay(2000)
Then click('/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.ScrollView/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.LinearLayout[2]/android.widget.Button[3]')
Any help would be highly appreciated.....
It looks like Karate is timing out the session before the emulator and app gets a chance to load fully:
Read timed out, http call failed after 32303 milliseconds for url: https://oauth-abdulkadir786-684f1:1bd00f8e-392f-4b4c-8f0e-2597cc9912a3#ondemand.eu-central-1.saucelabs.com:443/wd/hub/session
The suspicious parts are Read timed out, 32303 milliseconds (which is pretty close to 30 seconds and so is probably a config thing; 30 or 60 seconds is a common default timeout) and the path /wd/hub/session looks like the initial POST request which starts a sesson.
You'll probably have more luck if you increase the connectTimeout and readTimeout, either in your Background or in karate-config.js:
karate.configure('connectTimeout', 60000);
karate.configure('readTimeout', 60000);

WebdriverIO: Retrieving browser logging

According to WebdriverIO-Dokumentation I can integrate the output of browser console logging into webdriverio-logging. My call is then browser.getLogs('browser'). However, only log messages issued with console.warn() are retrieved. All console.log() messages are ignored. How can I manage that and include all of console messages into my webriverio report?
If you are using a recent version of Chrome and find that you only get warning and error messages in your logs, but you want INFO as well, add the following into your wdio.conf.js:
exports.config = {
capabilities: [{
...
"goog:loggingPrefs": { // <-- Add this
browser: "ALL",
},
}],
};

BrowserMob Proxy and Webdriverio minimal, empty HAR file

I was wondering if anyone has any idea as to what could be the problem or additional steps I could take in resolving the following issue.
I have a requirement to capture the network traffic so I can write some selenium tests verifying certain request headers.
The problem is when trying to use Webdriver.io + Browsermob proxy the HAR file created contains very minimal information.
I have tried using the C# bindings of the proxy and that resulted in the same issue as the Javascript ones. The only bindings that I got to work which returned data in the HAR file were the Java ones. There's a business requirement though that I must use Webdriver.io to implement this.
I have checked a number of other Questions and Answers from stack overflow but to no avail. Most have not been answered and the ones that have been have not worked for me just yet.
The code I am currently running is very similar to this one with the difference being the URL I'm trying to get the information from.
The difference between my Java code which worked and the Javascript and C# ones was that the Java one sets up the proxy programmatically whereas the other two expect the proxy to be already running and just connect to it.
Even with that in mind, when I start the C# or Javascript tests the proxy registers the new connection. The selenium server also starts up fine. Both cleanup with no issues according to their respective consoles once the tests are finished.
Are there any other ways to potentially debug this? Or even alternatives to capture the network traffic (Must work cross browser - already have a solution which works for chrome using chrome-remote-interface but we saw suggestions to use browsermob proxy for cross browser network capture).
Thanks for your time
Something I forgot to mention which is pretty important. Below is the npm package I am using for the browsermob-proxy :
https://www.npmjs.com/package/browsermob-proxy
Okay so, I figured out why I wasn't getting any data. I hope this saves others some time and hassle.
The problem is the way browsermob proxy handles localhost. I instead switched the proxy to use my IPV4 address and it started capturing all the HAR data.
See the code below:
//BroswerMobProxy + webdriver.io
//npm package used https://www.npmjs.com/package/browsermob-proxy
var webdriverio = require('webdriverio');
//proxy settings, host is IPV4 address
var Proxy = require('browsermob-proxy').Proxy
, fs = require('fs')
, proxy = new Proxy({host: 'Put IPV4 Address Here', proxyPort: 8081 , selHost: 'Put IPV4 Address Here'});
;
//convenience method that
proxy.cbHAR({captureHeaders: true, captureContent: true, captureBinaryContent: true }, doSeleniumStuff, function(err, data) {
if (err) {
console.error('ERR: ' + err);
} else {
/* Make sure har results are in the correct shape
* for any further processing
*/
var harResultsString = JSON.stringify(data);
var harResultsJson = JSON.parse(harResultsString);
//Write HAR file
fs.writeFileSync('DemoFile.json', harResultsJson, 'utf8');
//Print to console
console.log(harResultsJson);
}
});
//webdriver.io options
const opts = {
desiredCapabilities:{
browserName: 'chrome',
proxy: {
proxyType: 'MANUAL',
httpProxy: String(proxy.host)+":"+String(proxy.proxyPort),
sslProxy: String(proxy.host)+":"+String(proxy.proxyPort),
socksProxy:String(proxy.host)+":"+String(proxy.proxyPort),
socksVersion: 4,
autodetect: false
},
acceptSslCerts: true,
acceptInsecureCerts: true
},
host: 'Put IPV4 Address here',
port: 4444,
protocol: 'http',
coloredLogs: true,
proxy: 'http://'+String(proxy.host)+":"+String(proxy.proxyPort),
}
function doSeleniumStuff(proxy, cb) {
var browser = webdriverio.remote(opts);
// console.log(browser.options);
browser
.init()
.url('http://yahoo.com.au')
.getTitle().then(function(title) {
console.log('Title was: ' + title);
})
.end().then(cb).catch(e => console.log(e));
}

WebRTC TURN Server - I set it up, but it's not working

I've set up a text chat service using the PeerJS implementation of WebRTC's data channel. PeerJS provides a basic signalling server for this purpose, but I have tried to replace that with STUN and TURN servers set up through XirSys (recommended by SimpleWebRTC, another WebRTC library). I haven't deployed to the web yet.
Using Node to serve my static files locally, it will work on a local network (when I am sitting next to the person and they navigate to my ip/port in the browser), but will not work when connecting through different access points on the same network (i.e. at work, on opposite ends of the building).
My hypothesis is that it's hitting a firewall, but still directing traffic to PeerJS' signalling server without falling back to the XirSys STUN and TURN servers I've tried to set up. Here's the code I'm working with:
var stun = {};
var turn1 = {};
var turn2 = {};
$.ajax({
type: "POST",
dataType: "json",
url: "https://api.xirsys.com/getIceServers",
data: {
ident: "myusername",
secret: "long-alphanumeric-secret-key",
domain: "www.adomain.com",
application: "anapp",
room: "aroom",
secure: 1
},
success: function (data, status) {
console.log(data);
stun = data.d.iceServers[0];
turn1 = data.d.iceServers[1];
turn2 = data.d.iceServers[2];
},
async: false
});
var conn;
// Connect to PeerJS, have server assign an ID instead of providing one
var peerID = prompt('What would you like your screen name to be?');
var peer = new Peer(
peerID,
{key: 'mypeerjsserverkey', debug: true},
{
config: {'iceServers': [
{url: stun.url},
{url: turn1.url, credential: turn1.credential, username: turn1.username},
{url: turn2.url, credential: turn2.credential, username: turn2.username}
]
}
});
NOTE: My ident, secret, domain, etc. obviously aren't accurately represented here. I don't think that's where my problem is.
Any thoughts?
If you email us a wireshark capture of your STUN/TURN traffic, we should be able to outline where your problem is. Messages sent over signalling are separate but parallel to WebRTC messages. Therefore, if the app is working but the messages are being sent over signalling, then it's possible the configuration of the application isn't correct.
XirSys provides TURN via UDP over TCP through port 80/443, so if the signalling is connecting and flowing, so should the TURN.
Also, looking at your code, if you pass data.d from your getIceServers success handler to the PeerJS config, that should reduce your code quite a bit :-) The ICE string you're reconstructing doesn't need to be broken down.
Regards,
Lee
XirSys CTO