title: Uncaught (in promise) DOMException: Error processing ICE candidate WebRTC RTCIceCandidate
body: <p>turns out this error please help where the problem</p>
  
  <p>** <em>Uncaught (in promise) DOMException: Error processing ICE candidate</em> **</p>
  
  <p><a href="https://i.stack.imgur.com/ofRvQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ofRvQ.png" alt="enter image description here"></a></p>
  
  <p>here is the source code of the call</p>
  
  <p>ConOut.getStartScreenSharing => ConIn.socket.on('OnMessage') => onOffer()</p>
  
  <p>there the <strong>getStartScreenSharing</strong> function is called</p>
  
  <p>did everything according to the example</p>
  
  <p>using Chrome  68.0.3440.106 browser</p>
  
  <pre><code>import Vue from "vue";
  
  export default class ConOut {
    constructor() {
  
      let t = this;      
      t.pc = new RTCPeerConnection();
  
      this.socket = Vue.prototype.$signalR;
  
      this.socket.on('OnMessage', (chName, message) =&gt; {
  
        var desc = JSON.parse(message);    
        if (desc.type === 'candidate') {    
          t.pc.addIceCandidate(new RTCIceCandidate({
            sdpMLineIndex: desc.label,
            candidate: desc.candidate
          }))    
        }
  
        if (desc.type == 'answer') {
          t.pc.setRemoteDescription(desc);
        }
      });
  
      this.socket.start().then(function () {});
    }
  
    send = function (message) {
      this.socket.invoke("SendOtherV2", this.channelName, JSON.stringify(message));
    }
  
    getStartScreenSharing() {
      let t = this;    
      navigator.getUserMedia({
        audio: false,
        video: true
      }, function (stream) {
  
        t.pc.addStream(stream);
  
        t.pc.createOffer().then(function (ff) {
          t.pc.setLocalDescription(ff);
          t.send({
            type: "offer",
            offer: ff
          });
        });
  
        t.pc.onicecandidate = function (event) {    
          if (event.candidate) {
            t.send({
              type: 'candidate',
              label: event.candidate.sdpMLineIndex,
              id: event.candidate.sdpMid,
              candidate: event.candidate.candidate
            })
          };
  
          t.pc.onaddstream = function (s) {
            t.CreateVideoTag(s)
          }
        };
      })
    }
  };
  </code></pre>
  
  <p>here we wait for the Offer and answer</p>
  
  <pre><code>import Vue from "vue";
  
  export default class ConIn {
    constructor() {
  
      let t = this;
  
      t.pc = new RTCPeerConnection();
      this.socket = Vue.prototype.$signalR;
  
      this.socket.on('OnMessage', (chName, message) =&gt; {
  
        var desc = JSON.parse(message);
        if (desc.type === 'candidate') {
          console.log(desc)
  
          t.pc.addIceCandidate(new RTCIceCandidate({
            sdpMLineIndex: desc.label,
            candidate: desc.candidate
          }))
  
        } else {
          t.onOffer(desc.offer)
        }
      });
  
      this.socket.start().then(function () {});
    }
  
    send = function (message) {
      this.socket.invoke("SendOtherV2", this.channelName, JSON.stringify(message));
    }
  
    onOffer(offer) {
      let t = this;
  
      navigator.getUserMedia({
        audio: false,
        video: true
      }, function (stream) {
        t.pc.addStream(stream);
        t.pc.setRemoteDescription(new RTCSessionDescription(offer), function () {
          t.pc.createAnswer(function (answer) {
            t.pc.setLocalDescription(answer);
            t.send(answer)
          });
        });
  
        t.pc.onicecandidate = function (event) {   
  
          if (event.candidate) {
            t.send({
              type: 'candidate',
              label: event.candidate.sdpMLineIndex,
              id: event.candidate.sdpMid,
              candidate: event.candidate.candidate
            })
          }
  
          t.pc.onaddstream = function (s) {
            t.CreateVideoTag(s)
          }
        };
      })
    }     
  };
  </code></pre>