aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/vcNarrator.tsx
diff options
context:
space:
mode:
authorVendicated <vendicated@riseup.net>2023-04-17 00:21:49 +0200
committerVendicated <vendicated@riseup.net>2023-04-17 00:21:49 +0200
commitca5d24385f78e8021cb4d2099177ec63fb0c5af2 (patch)
tree0294deb33b76c8e27c5e0d82752463ee7d6170e3 /src/plugins/vcNarrator.tsx
parentcb3bd4b8818aca279511c95b25eaefd639bd6a8c (diff)
downloadVencord-ca5d24385f78e8021cb4d2099177ec63fb0c5af2.tar.gz
Vencord-ca5d24385f78e8021cb4d2099177ec63fb0c5af2.tar.bz2
Vencord-ca5d24385f78e8021cb4d2099177ec63fb0c5af2.zip
Fix errors on setups with no Notifications/SpeechSynthesis support
Diffstat (limited to 'src/plugins/vcNarrator.tsx')
-rw-r--r--src/plugins/vcNarrator.tsx11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/plugins/vcNarrator.tsx b/src/plugins/vcNarrator.tsx
index 7a06fe9..ee5c0d4 100644
--- a/src/plugins/vcNarrator.tsx
+++ b/src/plugins/vcNarrator.tsx
@@ -192,10 +192,13 @@ export default definePlugin({
authors: [Devs.Ven],
start() {
- if (speechSynthesis.getVoices().length === 0) {
- new Logger("VcNarrator").warn("No Narrator voices found. Thus, this plugin will not work. Check my Settings for more info");
+ if (typeof speechSynthesis === "undefined" || speechSynthesis.getVoices().length === 0) {
+ new Logger("VcNarrator").warn(
+ "SpeechSynthesis not supported or no Narrator voices found. Thus, this plugin will not work. Check my Settings for more info"
+ );
return;
}
+
FluxDispatcher.subscribe("VOICE_STATE_UPDATES", handleVoiceStates);
FluxDispatcher.subscribe("AUDIO_TOGGLE_SELF_MUTE", handleToggleSelfMute);
FluxDispatcher.subscribe("AUDIO_TOGGLE_SELF_DEAF", handleToggleSelfDeafen);
@@ -214,11 +217,11 @@ export default definePlugin({
voice: {
type: OptionType.SELECT,
description: "Narrator Voice",
- options: speechSynthesis.getVoices().map(v => ({
+ options: speechSynthesis?.getVoices().map(v => ({
label: v.name,
value: v.voiceURI,
default: v.default
- }))
+ })) ?? []
},
volume: {
type: OptionType.SLIDER,