code works on the web simulator but not in the emulator

250 views Asked by At

I am trying to implement and test this code:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum- scale=1.0">
<meta name="description" content="Tizen basic template generated by Tizen Web IDE"/>

<title>Tizen Web IDE - Tizen - Tizen basic Application</title>

<link rel="stylesheet" type="text/css" href="css/style.css"/>
<script src="js/main.js"></script>
<script src="js/annyang.min.js"></script>
<script>
window.onload = function(){
/* if (annyang) {
    var commands = {
        'Good': function() {
            alert('Hi! I can hear you.');
        }
    };
    annyang.addCommands(commands);
    annyang.start(); 
}*/

if (annyang) {
console.log("Enter");
  // Let's define a command.
  var commands = {
   'ok watch': function() { alert("My alert"); }
 };


 annyang.debug();
// Add our commands to annyang
 annyang.addCommands(commands);

// Start listening.
annyang.start();
    }
    else {
    alert("Error alert");
      }
 }
</script>
</head>

<body>

</body>
</html>

The problem is that this code works fine with the Tizen web simulator, but in the Tizen emulator I got this error ("My alert").

What's wrong? Thanks in advance.

1

There are 1 answers

0
Konrad On

SpeechRecognition needed by annyang is not implemented. According to documentation Web Speech is implemented only partially (API Reference > W3C/HTML5 API Reference > Media section):

W3C Web Speech API defines a JavaScript API to enable web developers to incorporate speech recognition and synthesis into their web pages. The attributes and events currently not supported are:

  • rate, pitch, volume, voiceURI of SpeechSynthesisUtterance interface
  • onmark, onboundary of SpeechSynthesisUtterance interface

The interfaces currently not supported are:

  • SpeechRecognition interface
  • SpeechSynthesisVoiceList interface

SpeechSynthesis