• Login
    • Search
    • Categories
    • Recent
    • Tags
    • Users
    • Groups
    • Rules
    • Help

    Do more on the web, with a fast and secure browser!

    Download Opera browser with:

    • built-in ad blocker
    • battery saver
    • free VPN
    Download Opera

    SpeechSynthesis has no voices or errors Opera 28 Android 4.4.2

    Opera for Android
    1
    2
    1114
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • maherrj
      maherrj last edited by

      window.speechSynthesis.getVoices().length returns 0

      Opera never triggers onvoiceschanged yet (on windows desktop) the call to speechSynthesis.speak(chat) works and after the voice invocation getVoices() now returns an array of length one. On Android I get no audio and no errors and absolutely no events 😞

      Please help.

      Cheers Richard Maher

      <!DOCTYPE html>
      <html>
      <head>
      <script type="text/javascript">
      var voices;
      var done = false;
      function fini()
      {
      alert("end");
      }function errorLog()
      {
      alert("error");
      }
      function talk()
      {
      if (!('speechSynthesis' in window)) {
      alert("Unsupported browser");
      return;
      }
      alert("Count is "+speechSynthesis.getVoices().length);

      try {
          speechSynthesis.onvoiceschanged = function() {
          voices = window.speechSynthesis.getVoices();
          alert("Voices " + voices.length);
          if (!done) theWork();
          };
          voices = speechSynthesis.getVoices();
          if (voices.length != 0) theWork();
      } catch (err) {alert("0");alert(err.description||err.message);}
      alert("Hello");
      

      }

      function theWork()
      {
      done = true;
      alert("Getting ready." + speechSynthesis.speaking + voices.length);
      var utterance = "Hello World";
      var chat;
      try {
      chat = new SpeechSynthesisUtterance(utterance);
      } catch (err) {alert("1");alert("new error "+ err.description||err.message);}
      alert("a");

      try {
      chat.addEventListener('end', fini, false);
      } catch (err) {alert("2");alert("AddEvent "+ err.description||err.message);}
      alert("b");
      try {
      chat.addEventListener('error', errorLog, false);
      } catch (err) {alert("3");alert("AddEvent "+ err.description||err.message);}
      alert("c");
      try {
      chat.addEventListener('abort', errorLog, false);
      } catch (err) {alert("4");alert("AddEvent "+ err.description||err.message);}
      alert("d");
      
      try {
         speechSynthesis.speak(chat);
      } catch (err) {alert("5");alert("Speak "+ err.description||err.message);}
      alert("e");
      

      }
      </script>
      </head>
      <body>

      On Safari this example won't fire any known events

      onend, onerror, even onended: -

      <input type="button" value="Talk" onclick="talk()" />

      No probs on Chrome or Opera. Spewin!
      </body>
      </html>

      Reply Quote 0
        1 Reply Last reply
      • maherrj
        maherrj last edited by

        Here's the best strategy I can come up with as Opera is small beer and I have to get on to speech Recognition: -

        The first getVoices() tells Opera to swing into action.
        Opera needs you to release the thread so it can get the voices info
        Opera will not honour/deliver the onvoiceschanged event.
        I stick a setTimout(myvoicesHandler,0) in there.
        If the handler gets voices it updates the selections else it stays at zero
        the feature detection has to move way down into the code

        But why are there no voices on Opera 28 Android 4.4.2?

        Reply Quote 0
          1 Reply Last reply
        • First post
          Last post

        Computer browsers

        • Opera for Windows
        • Opera for Mac
        • Opera for Linux
        • Opera beta version
        • Opera USB

        Mobile browsers

        • Opera for Android
        • Opera Mini
        • Opera Touch
        • Opera for basic phones

        • Add-ons
        • Opera account
        • Wallpapers
        • Opera Ads

        • Help & support
        • Opera blogs
        • Opera forums
        • Dev.Opera

        • Security
        • Privacy
        • Cookies Policy
        • EULA
        • Terms of Service

        • About Opera
        • Press info
        • Jobs
        • Investors
        • Become a partner
        • Contact us

        Follow Opera

        • Opera - Facebook
        • Opera - Twitter
        • Opera - YouTube
        • Opera - LinkedIn
        • Opera - Instagram

        © Opera Software 1995-