title: Web speech API: Consistently get the supported speech synthesis voices on iOS safari
body: <p>I'm trying to get the list of supported speech synthesis voices on iOS Safari.</p>
  
  <p>As per the API, I should be able to get an array of voices by calling:</p>
  
  <pre><code>window.speechSynthesis.getVoices();
  </code></pre>
  
  <p>Sometimes this gives me list of voices, other times it doesn't. See the following jsfiddle: <a href="https://jsfiddle.net/sq7xf327/">https://jsfiddle.net/sq7xf327/</a></p>
  
  <p>If I open this on my iPhone 5 (iOS 8.1.3), I don't get back consistent results. Sometimes I get back all 37 voices, and other times I get returned 0 voices. If you keep on refreshing it sporadically displays either 37 or 0.</p>
  
  <p>I know that in Chrome you can add an event listener to the  </p>
  
  <pre><code>window.speechSynthesis.voiceschanged 
  </code></pre>
  
  <p>event to know when the voices have loaded, but this event is not supported in Safari.</p>
  
  <p>A trick I've tried is to check periodically:</p>
  
  <pre><code>var timer = setInterval(function () {
      window.voices_ = window.speechSynthesis.getVoices();
      if (window.voices_.length &gt; 0) {
          clearInterval(timer);
      }
  }, 1000);
  </code></pre>
  
  <p>This has also not given me consistent results.</p>
  
  <p>Any idea how I can reliably and consistently get the supported speech synthesis voices on iOS Safari?</p>