Sunday, April 7, 2024
HomeiOS Developmentios - WebRTC App does not work whereas an iPhone or MacBook...

ios – WebRTC App does not work whereas an iPhone or MacBook is linked


I’m having issues with my WebRTC software when an iPhone or Macbook is linked. This solely occurs when an iPhone or Macbook is linked, as exams with Home windows or Android units have proven no points.

As could be seen within the screenshot beneath, it seems that the datachannel shouldn’t be initialised appropriately. In actual fact, the webcam and microphone don’t work even when permissions are given by the consumer, and messages and the distant webcam usually are not despatched/proven.
enter picture description right here

If I open chrome console on Home windows, that is the error I get within the console:
enter picture description right here

UPDATE: On OpenGX it appears to be working
May you please assist me examine this drawback. I connect the capabilities that appear to be liable for the issues:

 const configuration = {
    iceServers: [...turnServers, { urls: 'stun:stun.1und1.de:3478'}],
    iceTransportPolicy: 'relay'
  };

  peerConection = new RTCPeerConnection(configuration);

  dataChannel = peerConection.createDataChannel("chat");

  peerConection.ondatachannel = (occasion) => {
    const dataChannel = occasion.channel;

    dataChannel.onopen = () => {
      console.log("peer connection is able to obtain knowledge channel messages");
    };

    dataChannel.onmessage = (occasion) => {
      console.log("message got here from knowledge channel");
      const message = JSON.parse(occasion.knowledge);
      ui.appendMessage(message);
    };
  };

  peerConection.onicecandidate = (occasion) => {
    console.log("geeting ice candidates from stun server");
    if (occasion.candidate) {
      // ship our ice candidates to different peer
      wss.sendDataUsingWebRTCSignaling({
        connectedUserSocketId: connectedUserDetails.socketId,
        sort: constants.webRTCSignaling.ICE_CANDIDATE,
        candidate: occasion.candidate,
      });
    }
  };

  peerConection.onconnectionstatechange = (occasion) => {
    if (peerConection.connectionState === "linked") {
      console.log("succesfully linked with different peer");
    }
  };
  const stringifiedMessage = JSON.stringify(message);

  if (dataChannel && dataChannel.readyState === 'open') {
    dataChannel.ship(stringifiedMessage);
  } else {
    console.log('canale non aperto');
  }
};

Already tried to analyze the problem utilizing Chrome console log and Safari console log. Already tried to assessment the logic and replace stun server url.



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments