-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathaboutblanktestpage.html
64 lines (59 loc) · 1.94 KB
/
aboutblanktestpage.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Text to Speech Testing Page</title>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
font-family: Arial, sans-serif;
background-color: #f4f4f4;
text-align: center;
}
.container {
max-width: 600px;
}
.message {
font-size: 36px;
color: #333;
margin-bottom: 20px;
}
button {
padding: 10px 20px;
font-size: 18px;
cursor: pointer;
}
</style>
</head>
<body>
<div class="container">
<div class="message">
Hello, you have discovered a testing page.<br>
Use the back arrow to go back.
</div>
<button onclick="speak()">Speak</button>
</div>
<script>
function speak() {
const message = "Hello, you have discovered a testing page. Use the back arrow to go back.";
const speech = new SpeechSynthesisUtterance(message);
speech.lang = "en-US";
speech.pitch = 1;
speech.rate = 1;
// Try to select a male voice
const voices = window.speechSynthesis.getVoices();
speech.voice = voices.find(voice => voice.lang === "en-US" && voice.name.includes("Male")) || voices[0];
window.speechSynthesis.speak(speech);
}
// Preload the voices to make sure they are ready
window.speechSynthesis.onvoiceschanged = () => {
speak(); // This line can be removed if you don't want the voice to be preloaded automatically
};
</script>
</body>
</html>