mirror of
https://github.com/ggerganov/wave-share.git
synced 2026-04-18 20:45:57 +08:00
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:
2
main.cpp
2
main.cpp
@@ -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
11
main.js
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user