Collaborama About Help Contact Anonymous [login] Source: site.view [edit] Function name: test Arguments: Description: Page type: html Render function: Module: sportstreak Page source: <!DOCTYPE html> <html> <head> <title>Test Speech</title> <script type="text/javascript"> function initSpeech() { var recognition = new (window.SpeechRecognition || window.webkitSpeechRecognition || window.mozSpeechRecognition || window.msSpeechRecognition)(); recognition.lang = 'en-US'; // Set the language recognition.continuous = false; // Set to true if you want the recognition to continue even after a result is returned recognition.interimResults = false; // Set to true if you want interim results document.getElementById('start-btn').addEventListener('click', function() { recognition.start(); }); document.getElementById('stop-btn').addEventListener('click', function() { if (navigator.vendor.indexOf('Apple') > -1) { try{ recognition.start(); } catch(err) { } } recognition.stop(); }); recognition.onresult = function(event) { var transcript = event.results[0][0].transcript; document.getElementById('transcript').textContent = transcript; }; }; </script> </head> <body onload="initSpeech()"> <button id="start-btn">Start Speech Recognition</button> <button id="stop-btn">Stop Speech Recognition</button> <div id="transcript"></div> </body> </html>