| <!doctype html> |
| <body> |
| <script> |
| window.results = null; |
| |
| window.getFirstTranscript = function() { |
| var rs = window.results; |
| if (!rs || !rs.length) { return 'NOTFOUND'; } |
| var r = rs[0]; |
| if (!r.length) { return 'NOTFOUND'; } |
| return r.item(0).transcript; |
| }; |
| |
| window.testSpeechRecognition = function() { |
| var reco = new webkitSpeechRecognition(); |
| reco.continuous = true; |
| reco.onresult = function(e) { |
| try { |
| document.title = 'PASS'; |
| window.results = e.results; |
| } catch(ex) { |
| document.title = 'FAIL'; |
| } |
| } |
| reco.onerror = function(e) { |
| document.title = 'FAIL'; |
| } |
| try { |
| reco.start(); |
| } catch(e) { |
| document.title = 'FAIL'; |
| } |
| }; |
| </script> |
| </body> |