Created
October 31, 2017 18:20
-
-
Save alejandrolechuga/6b51b1135664844159a356c62757cc35 to your computer and use it in GitHub Desktop.
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
<!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