title: Web Audio API and livestream delay
body: <p>I've been developing an audio conference application with Web Audio API and Node.js. One person will speak and other clients who are connected should hear him.  </p>
  
  <p>On the client-side I'm encoding PCM samples with libopus before sending them into server.  </p>
  
  <p>On the server-side I'm just sending those encoded packets back to users who are connected, and finally on each client I'm decoding those packets back to samples that can be played with Web Audio API.  </p>
  
  <p>When I'm testing the application on local environment everything is working just fine. On production environment, when the clients can connect from outside local space, couple major problems will occur.</p>
  
  <ol>
  <li><p>Some clients will have a delay in their audio which seems to be increasing.
  For example, if the stream has been going on for 1min the delay for some clients can be as big as 10 seconds, and after couple of minutes the delay for some clients is even bigger 30-50 seconds.  </p></li>
  <li><p>Some clients have no problems.</p></li>
  <li><p>Especially the clients that are experiencing the delay, the sound is extremely low-pitched. This can happen for the clients who have no delay in their audio aswell. </p></li>
  </ol>