Forum Discussion

JoanneChen's avatar
JoanneChen
Super Hero
2 years ago

Why my Javascript(Voice to Text) works differently when publishing to Web and Review 360?

I am adding a voice to text function with Javascript in a project. It works perfectly as expect when publishing to Web. But when I publish to Review360, it doesn't work at all. I am wondering is there anyone who can tell me why it won't work in Review 360?


Here is the code:
----------------------------------------------------------------------------------
// Initialize SpeechRecognition
const recognition = new (window.SpeechRecognition || window.webkitSpeechRecognition)();
recognition.lang = 'en-US';

// Global variable to store the recognized text
let recognizedText = '';

// Event handlers
recognition.onresult = (event) => {
  recognizedText = event.results[0][0].transcript;
  console.log('Speech Recognition Result:', recognizedText);

  // Set the recognized text to the third-party software's variable
  player.SetVar("UserResponce", recognizedText);
};

recognition.onerror = (event) => {
  console.error('Speech recognition error:', event.error);
};

// Function to start recognition
function startRecognition() {
  recognition.start();
}

// Trigger recognition when needed (e.g., when your button is clicked)
// You can call startRecognition() from your third-party software's trigger
startRecognition();
----------------------------------------------------------------------------------
I'll appreciate if someone know how to modify it to work as well in Review 360.

    • JoanneChen's avatar
      JoanneChen
      Super Hero

      Hi Phil, thanks for reply. I got a error "Speech recognition error: not-allowed" in the console. So It's Review360 bocks it, right?

  • When publishing to Review and checking your console... you immediately notice an error telling you 'Speech recognition: not allowed'. Thus Articulate has blocked it.

    @Articulate: Do allow users to use this for testcases.

    • JoanneChen's avatar
      JoanneChen
      Super Hero

      Thanks Math for testing it. Yes, It shows "Speech recognition error: not-allowed" in the console.  Since Review360 is design for testing and review. They should unblock it.

      @Artivulate @Dan Backes @Mike Swart 

  • Google have a history of blocking any of their stuff working in frames unless they want it to work.

  • same problem with

    • allow="autoplay"
    • allow="clipboard-write"

    the outer website

    • "360.articulate.com"

    has to allow the inner iframe the "special" features hosted on

    • "articulateusercontent.com"

    360.articulate.com => articulateusercontent.com = cross-domain