Web Component wrapper to the Web Speech API, that allows you to do voice recognition (speech to text) and speech synthesis (text to speech) using Polymer.
Really nifty! Thanks to Polymer you’ll be provided with two extra elements you can use: <voice-player>
for text to speech and <voice-recognition>
for speech to text
<-- text to speech -->
<voice-player autoplay text="Welcome to the jungle! hahaha just kidding!"></voice-player>
<-- speech to text -->
<form id="recognition-form" class="pure-form">
<fieldset>
<textarea id="recognition-input" readonly=""></textarea>
</fieldset>
<fieldset>
<button id="recognition-submit" class="pure-button pure-button-primary">Start!</button>
</fieldset>
</form>
<voice-recognition id="recognition-element"></voice-recognition>
<script>
var form = document.querySelector('#recognition-form'),
input = document.querySelector('#recognition-input'),
element = document.querySelector('#recognition-element');
form.addEventListener('submit', function(e) {
e.preventDefault();
element.start();
});
element.addEventListener('result', function(e) {
input.textContent = e.detail.result;
});
</script>