Skip to content

Commit

Permalink
fix(chat-box): fix voice box for safari
Browse files Browse the repository at this point in the history
wait for voiceschanged only for chrome
  • Loading branch information
xmlking committed Nov 12, 2018
1 parent ed7addd commit 5068a72
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions apps/webapp/src/manifest.json
@@ -1,5 +1,5 @@
{
"name": "webapp",
"name": "NGX Starter Kit",
"short_name": "webapp",
"theme_color": "#1976d2",
"background_color": "#fafafa",
Expand Down Expand Up @@ -48,4 +48,4 @@
"type": "image/png"
}
]
}
}
9 changes: 6 additions & 3 deletions libs/chat-box/src/lib/services/text-to-speech.service.ts
Expand Up @@ -24,9 +24,12 @@ export class TextToSpeechService {
}

public async getVoiceList(): Promise<SpeechSynthesisVoice[]> {
await new Promise((resolve, reject) => {
this.speechSynthesis.addEventListener('voiceschanged', resolve);
});

if ('onvoiceschanged' in speechSynthesis) {
await new Promise((resolve, reject) => {
this.speechSynthesis.addEventListener('voiceschanged', resolve);
});
}
return this.speechSynthesis.getVoices();

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

0 comments on commit 5068a72

Please sign in to comment.