Skip to content

Instantly share code, notes, and snippets.

@w-jerome
Last active April 13, 2018 12:53
Show Gist options
  • Save w-jerome/1e7d81fa8cc7bfa36a1c86e84d40912f to your computer and use it in GitHub Desktop.
Save w-jerome/1e7d81fa8cc7bfa36a1c86e84d40912f to your computer and use it in GitHub Desktop.
Javascript — Listen text
var text = document.querySelector('.post-content').textContent
var speech = new SpeechSynthesisUtterance();
speech.text = text;
speech.volume = 1;
speech.rate = 1;
speech.pitch = 1;
// Start speak
window.speechSynthesis.speak(speech);
// Stop speak
//window.speechSynthesis.cancel(speech);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment