Skip to content

Instantly share code, notes, and snippets.

@alejandrolechuga
Created October 31, 2017 18:20
Show Gist options
  • Save alejandrolechuga/6b51b1135664844159a356c62757cc35 to your computer and use it in GitHub Desktop.
Save alejandrolechuga/6b51b1135664844159a356c62757cc35 to your computer and use it in GitHub Desktop.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/div/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title> DeviceInfo </title>
<style>
body {
font-size: 16px;
color: black;
background-color: white;
padding: 100px;
}
.output {
width: 100%;
height: 300px;
border: 4px solid black;
}
</style>
<script language="javascript" type="text/javascript">
var list = [
"It's Always Sunny in Philadelphia",
"You're the Best",
"It's Dannie's Birthday"
];
var index = 0;
function speak(text) {
var el = document.getElementById('output')
stopSpeaking();
var textToSpeech = 'Saying : ' + text;
el.innerHTML = textToSpeech
console.log(textToSpeech);
vod.speechStart(text);
}
function stopSpeaking () {
console.log('Stop TTS')
vod.speechStop();
}
function tryPunctuation () {
speak(list[index]);
index++
if (index === list.length) index = 0;
}
window.addEventListener('keyup', function (event) {
tryPunctuation();
});
</script>
</head>
<body>
<div id="output" class="output">PRESS ANY KEY</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment