mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Fix System TTS on iOS
This commit is contained in:
@ -1,3 +1,4 @@
|
|||||||
|
import { isMobile } from "../../RossAscends-mods.js";
|
||||||
import { getPreviewString } from "./index.js";
|
import { getPreviewString } from "./index.js";
|
||||||
|
|
||||||
export { SystemTtsProvider }
|
export { SystemTtsProvider }
|
||||||
@ -112,6 +113,21 @@ class SystemTtsProvider {
|
|||||||
console.info("Using default TTS Provider settings");
|
console.info("Using default TTS Provider settings");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// iOS should only allows speech synthesis trigged by user interaction
|
||||||
|
if (isMobile()) {
|
||||||
|
let hasEnabledVoice = false;
|
||||||
|
|
||||||
|
document.addEventListener('click', () => {
|
||||||
|
if (hasEnabledVoice) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const utterance = new SpeechSynthesisUtterance('hi');
|
||||||
|
utterance.volume = 0;
|
||||||
|
speechSynthesis.speak(utterance);
|
||||||
|
hasEnabledVoice = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Only accept keys defined in defaultSettings
|
// Only accept keys defined in defaultSettings
|
||||||
this.settings = this.defaultSettings;
|
this.settings = this.defaultSettings;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user