From a91694ebbce7d193993602c54cce69b274e0e591 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sat, 2 Dec 2023 18:41:54 +0200 Subject: [PATCH] Change audio format check --- public/scripts/extensions/tts/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/scripts/extensions/tts/index.js b/public/scripts/extensions/tts/index.js index af434d37a..f43e192ff 100644 --- a/public/scripts/extensions/tts/index.js +++ b/public/scripts/extensions/tts/index.js @@ -421,12 +421,12 @@ function completeCurrentAudioJob() { /** * Accepts an HTTP response containing audio/mpeg data, and puts the data as a Blob() on the queue for playback - * @param {*} response + * @param {Response} response */ async function addAudioJob(response) { const audioData = await response.blob() - if (!(audioData.type in ['audio/mpeg', 'audio/wav', 'audio/x-wav', 'audio/wave', 'audio/webm'])) { - throw `TTS received HTTP response with invalid data format. Expecting audio/mpeg, got ${audioData.type}` + if (!audioData.type.startsWith('audio/')) { + throw `TTS received HTTP response with invalid data format. Expecting audio/*, got ${audioData.type}` } audioJobQueue.push(audioData) console.debug('Pushed audio job to queue.')