<!doctype html> <html> <head> <meta charset="utf-8"> <title>TTS Sample</title> <meta id="viewport" name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" /> <style> #samplediv{ display:flex; flex-grow:1; width:100%;} #speaktextarea{ flex-grow:1; height:200px; border:1px solid #000; font-size:24px; padding:6px;} .btn{ display:flex; justify-content:center; align-items:center; background-color:#000; color:#fff; width:120px;} </style> <script> function TextToSpeak(textstring) { // 지원확인 if(window.speechSynthesis) { const ssu = new SpeechSynthesisUtterance() const synth = window.speechSynthesis ssu.text = textstring; synth.speak(ssu); } else { alert("지원안됨") } } </script> </head> <body> <div id="samplediv"> <textarea name="speaktextarea" id="speaktextarea"></textarea> <a class="btn" onClick="TextToSpeak(document.getElementById('speaktextarea').value);">TTS</a> </div> </body> </html>
23. 7. 19.
Javascript Text To Speak (TTS)
피드 구독하기:
댓글 (Atom)
댓글 없음:
댓글 쓰기