WebRTC App doesn't work while an iPhone or MacBook is connected #2734
Unanswered
MatteoMammoliti
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am having problems with my WebRTC application when an iPhone or Macbook is connected. This only happens when an iPhone or Macbook is connected, as tests with Windows or Android devices have shown no issues.
As can be seen in the screenshot below, it appears that the datachannel is not initialised correctly. In fact, the webcam and microphone do not work even if permissions are given by the user, and messages and the remote webcam are not sent/shown.
If I open chrome console on Windows, this is the error I get in the console:
Could you please help me investigate this problem. I attach the functions that seem to be responsible for the problems:
` const configuration = {
iceServers: [...turnServers, { urls: 'stun:stun.1und1.de:3478'}],
iceTransportPolicy: 'relay'
};
peerConection = new RTCPeerConnection(configuration);
dataChannel = peerConection.createDataChannel("chat");
peerConection.ondatachannel = (event) => {
const dataChannel = event.channel;
};
peerConection.onicecandidate = (event) => {
console.log("geeting ice candidates from stun server");
if (event.candidate) {
// send our ice candidates to other peer
wss.sendDataUsingWebRTCSignaling({
connectedUserSocketId: connectedUserDetails.socketId,
type: constants.webRTCSignaling.ICE_CANDIDATE,
candidate: event.candidate,
});
}
};
peerConection.onconnectionstatechange = (event) => {
if (peerConection.connectionState === "connected") {
console.log("succesfully connected with other peer");
}
};`
` const stringifiedMessage = JSON.stringify(message);
if (dataChannel && dataChannel.readyState === 'open') {
dataChannel.send(stringifiedMessage);
} else {
console.log('canale non aperto');
}
};`
Beta Was this translation helpful? Give feedback.
All reactions