dimanche 5 juin 2016

Using microphone on mobile browsers

How can I access the microphone on mobile devices. For example I have this code:

<html>
<head>
    <!--jquery-->
    <script src="http://ift.tt/1pD5F0p"></script>
    
        <!--Custom Styles-->
    <link href="style.css" rel="stylesheet">
    
    <!--Bootstrap Styles-->
    <link href="http://ift.tt/1jAc5cP" rel="stylesheet" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
    
    <!--Bootstrap Styles-->
    <script src="http://ift.tt/1jAc4pg" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
    
    <!--Annyang Sound Recognition-->
    <script src="//cdnjs.cloudflare.com/ajax/libs/annyang/2.4.0/annyang.min.js"></script>

<title>Brain</title>    
</head>
<body>
    Say background black
    <script>
         if (annyang) {
          // Let's define our first command. First the text we expect, and then the function it should call
          var commands = {
            'background black': function() {
              console.log("Recognized");
              $("body").css("background-color", "black");
            }
          };

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

          // Start listening. You can call this here, or attach this call to an event, button, etc.
          annyang.start();
        }
    </script>
</body>
</html>

, which works totally fine on my Desktop Chrome, but not on my mobile Safari/Chrome(iOS) and neither on Chrome on android.

It doesn't even asks for permission, as it does on my Desktop.

Thanks for your help.




Aucun commentaire:

Enregistrer un commentaire