Skip to content

Commit 5068a72

Browse files
committed
fix(chat-box): fix voice box for safari
wait for voiceschanged only for chrome
1 parent ed7addd commit 5068a72

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

apps/webapp/src/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "webapp",
2+
"name": "NGX Starter Kit",
33
"short_name": "webapp",
44
"theme_color": "#1976d2",
55
"background_color": "#fafafa",
@@ -48,4 +48,4 @@
4848
"type": "image/png"
4949
}
5050
]
51-
}
51+
}

libs/chat-box/src/lib/services/text-to-speech.service.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@ export class TextToSpeechService {
2424
}
2525

2626
public async getVoiceList(): Promise<SpeechSynthesisVoice[]> {
27-
await new Promise((resolve, reject) => {
28-
this.speechSynthesis.addEventListener('voiceschanged', resolve);
29-
});
27+
28+
if ('onvoiceschanged' in speechSynthesis) {
29+
await new Promise((resolve, reject) => {
30+
this.speechSynthesis.addEventListener('voiceschanged', resolve);
31+
});
32+
}
3033
return this.speechSynthesis.getVoices();
3134

3235
// return new Promise((resolve: any, reject: any): void => {

0 commit comments

Comments
 (0)