Last active
August 29, 2015 14:02
-
-
Save johnschimmel/c9f5dbc0f438ba70f555 to your computer and use it in GitHub Desktop.
MeSpeak JS integration with custom youtube makeymakey player
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Copy this into your HTML file right aboove </body> --> | |
<!-- load jquery from cdn --> | |
<script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js'></script> | |
<!-- STEP 1 - load mespeak from your webserver UPDATE PATH. Download here http://www.masswerk.at/mespeak --> | |
<script type='text/javascript' src='http://www.productiondesign.nl/yt_player_mespeak/js/mespeak/mespeak.js'></script> | |
<script type='text/javascript'> | |
// STEP 2 - config mespeak you will need two files | |
// where mespeak_config.json is on your root directory of project directory | |
meSpeak.loadConfig('js/mespeak/mespeak_config.json'); | |
// same as above put en-us.json on project directory root - swap language file if yours is available | |
meSpeak.loadVoice('js/mespeak/nl.json'); | |
jQuery(document).ready( function() { | |
// add eventlistener to .box .pre items to trigger when focused | |
jQuery('.box .pre').focus(function(e) { | |
// stop all meSpeak | |
meSpeak.stop(); | |
// get title attribute from current focused link | |
var title = jQuery(this).attr('title').replace('+',' '); | |
// debug/log to chome console | |
console.log(title); | |
// STEP 3 - speak out title | |
meSpeak.speak(title); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment