title: WebRTC: Why Offer needs audio or video option turned on/true for just DataChannel?
body: <p>I'm trying to understand how WebRTC works, mainly for using only DataChannel for game-networking experience. And this is what I've made so far. It gather ICE cadidates. I have two questions.</p>
  
  <ol>
  <li>Does offer need to be done for gathering ICE?</li>
  <li>Why <code>offerToReceiveAudio</code> or <code>offerToReceiveVideo</code> needs to be set true, I'm gonna only use <code>Datachannel</code>. (without one of this option set to true, ICE doesn't appears) (solved, see EDIT bellow)</li>
  </ol>
  
  <p>Here goes a fiddle:</p>
  
  <p><a href="https://jsfiddle.net/t431a815/9/" rel="nofollow noreferrer">https://jsfiddle.net/t431a815/9/</a></p>
  
  <p>and code:</p>
  
  <pre><code>var iceServers = [
  
  ] 
  
  var config = {
    iceServers: iceServers,
    iceTransportPolicy: "all",
    rtcpMuxPolicy: 'negotiate'
  };
  
  var pcConstraints = {};
  var offerOptions = {offerToReceiveAudio: true};
  
  pcConstraints.optional = [{'googIPv6': true}]; // Whether we gather IPv6 candidates.
  
  var pc = new RTCPeerConnection(config, pcConstraints);
  pc.onicecandidate = iceCallback;
  pc.createOffer(
    offerOptions
  ).then(
    gotDescription,
    error
  );
  
  function gotDescription(desc) {
    console.log("OFFER DESC:", desc);
    pc.setLocalDescription(desc);
  }
  
  function error() {
    console.log("sth goes wrong", arguments);
  }
  
  function iceCallback(event) {
    console.log("ICE!", JSON.stringify(event.candidate));
  }
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>found solution but it's weird, you just need to create one datachannel before making offer, then it works with <code>offerToReceiveAudio: false, offerToReceiveVideo: false</code></p>
  
  <pre><code>var offererDataChannel = pc.createDataChannel('channel', {});
  </code></pre>
  
  <p>but why? What if I want to create it later?</p>