Fix the getIPs() function

Noticed it stopped working on Chrome.

Was using a stun server (due to copy paste from the reference link)
when one was not actually needed to create the RTCPeerConnection
This commit is contained in:
Georgi Gerganov
2019-06-13 20:51:26 +03:00
parent be44800fa0
commit 8ff24e125e
2 changed files with 3 additions and 10 deletions

View File

@@ -782,7 +782,7 @@ int init() {
devid_in = 0; devid_in = 0;
} else { } else {
printf("Obtained spec for input device (SDL Id = %d):\n", devid_out); printf("Obtained spec for input device (SDL Id = %d):\n", devid_in);
printf(" - Sample rate: %d\n", captureSpec.freq); printf(" - Sample rate: %d\n", captureSpec.freq);
printf(" - Format: %d (required: %d)\n", captureSpec.format, desiredSpec.format); printf(" - Format: %d (required: %d)\n", captureSpec.format, desiredSpec.format);
printf(" - Channels: %d (required: %d)\n", captureSpec.channels, desiredSpec.channels); printf(" - Channels: %d (required: %d)\n", captureSpec.channels, desiredSpec.channels);

11
main.js
View File

@@ -112,15 +112,8 @@ function getIPs(callback){
useWebKit = !!win.webkitRTCPeerConnection; useWebKit = !!win.webkitRTCPeerConnection;
} }
//minimal requirements for data connection
var mediaConstraints = {
optional: [{RtpDataChannels: true}]
};
var servers = {iceServers: [{urls: "stun:stun.services.mozilla.com"}]};
//construct a new RTCPeerConnection //construct a new RTCPeerConnection
var pc = new RTCPeerConnection(servers, mediaConstraints); var pc = new RTCPeerConnection(null);
function handleCandidate(candidate){ function handleCandidate(candidate){
//match just the IP address //match just the IP address
@@ -289,7 +282,7 @@ function senderInit() {
senderPC = new RTCPeerConnection(null); senderPC = new RTCPeerConnection(null);
senderPC.oniceconnectionstatechange = function(e) { senderPC.oniceconnectionstatechange = function(e) {
var state = senderPC.iceConnectionState; //var state = senderPC.iceConnectionState;
}; };
senderPC.onicecandidate = function(e) { senderPC.onicecandidate = function(e) {