UserMedia VoiceLang feature unreliable on iOS

0 favourites
  • 4 posts
  • Problem Description

    I'm working on a web app that uses speech synthesis. Unfortunately, the UserMedia function to add voices to a listbox does not work reliably on my iPad Plus or my iPhone 6+. (It only populates the list about 20% of the time.)

    Please not that this feature seems to work every time on my PC. I'm only having issues with my iOS devices.

    Attach a Capx

    To make sure it wasn't MY code causing the problem, I was using the "Speech Synthesis.capx" file in the Examples folder that comes with C2.

    Description of Capx

    The capx grabs a list of voices available on the device/browser and adds them to a listbox.

    Steps to Reproduce Bug

    • Go to my website using an iPhone 6+ or an iPad Plus (http://www.jmcdesign.orgfree.com).
    • Look at the voices in the listbox
    • Refresh the page over and over again (the listbox will frequently be empty)

    Observed Result

    The listbox is frequently empty when I reload the page. (About 75-80 percent of the time.)

    Expected Result

    The listbox should ALWAYS contain voices, so my users can choose an appropriate voice for their device.

    Affected Browsers

    I have seen similar results on both Safari and Chrome

    Operating System and Service Pack

    9.2.1

    Construct 2 Version ID

    r221 (64-bit)

  • According to https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesis/getVoices, listing the voices is not supported by Safari at all. I tried refreshing the speech synthesis example 10 times, and as expected, it never listed anything. So this is just Safari not supporting it rather than a C2 bug. When you say it sometimes works, what exactly are you seeing?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ashley: Usually, the first time I run the Speech Synthesis app on my iPhone or iPad the voices show up in the list box. But when I refresh the page the list doesn't populate. If I refresh it enough times (usually 5 to 8 or so) the list will appear again.

    Not sure if this helps but the French voice I need shows up like this: "fr-FR: Thomas (com.apple.ttsbundle.Thomas-compact)"

    My workaround is to look up the "platform" using the Browser object and then use the French voice that I manually set at design time. That seems to be working so far, but I need to get the platform name (and voice name) for Android and Mac.

  • Looks like this bug is closed, but I found THIS online:

    -----------------------------------------------------------------------------

    My question was: why does window.speechSynthesis.getVoices() return empty array, after page is loaded and onready function is triggered? As you can see if you click on the link, same function returns an array of available voices of Chrome by onclick triger?

    It seems Chrome loads window.speechSynthesis after the page load!

    The problem is not in ready event. If I remove the line var voice=... from ready function, for first click it shows empty list in console. But the second click works fine.

    It seems window.speechSynthesis needs more time to load after first call. You need to call it twice! But also, you need to wait and let it load before second call on window.speechSynthesis. For example, following code shows two empty arrays in console if you run it for first time:

    // First speechSynthesis call

    var voices = window.speechSynthesis.getVoices();

    console.log(voices);

    // Second speechSynthesis call

    voices = window.speechSynthesis.getVoices();

    console.log(voices);

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)