Restore iOS speech after cancelling queued audio
Build and publish frontend / publish (push) Failing after 2s
Build and publish frontend / publish (push) Failing after 2s
This commit is contained in:
+6
-3
@@ -93,7 +93,6 @@
|
||||
const voiceSettingsKey = 'ai-spel.voice-settings.v2';
|
||||
let voiceSettings = window.GameVoice.loadSettings(localStorage, voiceSettingsKey, 'ai-spel.voice-settings.v1');
|
||||
let voiceController;
|
||||
let speechActivatedByGesture = false;
|
||||
let audioContext;
|
||||
let voiceDisclosureAcknowledged = false;
|
||||
let adminOffset = 0;
|
||||
@@ -228,8 +227,8 @@
|
||||
},
|
||||
});
|
||||
function primeSpeechFromGesture(event) {
|
||||
if (speechActivatedByGesture || !event.isTrusted) return;
|
||||
speechActivatedByGesture = voiceController.activateFromUserGesture();
|
||||
if (!event.isTrusted) return;
|
||||
voiceController.activateFromUserGesture();
|
||||
}
|
||||
document.addEventListener('pointerdown', primeSpeechFromGesture, true);
|
||||
document.addEventListener('keydown', primeSpeechFromGesture, true);
|
||||
@@ -739,6 +738,10 @@
|
||||
refreshMicrophone();
|
||||
voiceController.stopListening();
|
||||
voiceController.cancelSpeech();
|
||||
// cancel() above may also have discarded Safari's silent speech-channel
|
||||
// primer. Restore it synchronously inside the submit gesture, before
|
||||
// waiting for the API response that will be read aloud.
|
||||
voiceController.activateFromUserGesture();
|
||||
messageField.value = '';
|
||||
try {
|
||||
if (stage === 'biography') await handleBiography(message);
|
||||
|
||||
Reference in New Issue
Block a user