add play all button

This commit is contained in:
tmshv committed 2025-08-25 21:57:31 +03:00
1 parent e0a6ddcafc
commit e5023e7709
4 files changed
+74 -2

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
import { state } from "./store/play";
function play() {
const synth = window.speechSynthesis;
const a = document.querySelector("article")
if (!a || !a.textContent) {
return
}
const u = new SpeechSynthesisUtterance(a.textContent)
const voice = synth.getVoices().find((v) => v.name === state.voice);
if (voice) {
u.voice = voice
}
synth.speak(u)
}
export default play