]> _ Git - fluidbook-toolbox.git/commitdiff
#7958 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 22 Jan 2026 14:52:34 +0000 (15:52 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 22 Jan 2026 14:52:34 +0000 (15:52 +0100)
.env.prod
app/Fluidbook/Compiler/Accessibility.php

index 7ee634b55241b5c94a8983ca6f5fa5d7b4e2016b..f1cdbffb185aa03ce53c38da5e4525b856306623 100644 (file)
--- a/.env.prod
+++ b/.env.prod
@@ -65,7 +65,8 @@ SCORM_CLOUD_APP_ID=VAAROP2RFR
 SCORM_CLOUD_SECRET_KEY=7PHpD9pQk4aIjUnlKgF8s89CGlhkIucZHJ3zMXuQ
 SCORM_CLOUD_PREFIX=toolbox_
 
-AZURE_TTS_API_KEY=adae11ef11d94aa98f31b2c233c1be7a
+AZURE_TTS_API_KEY=8RGdBNPGbrAuWktO5Ge6H1MI3tOUjN1zjAwkji0hYfE0PO1HjSKnJQQJ99CAAC5T7U2XJ3w3AAAYACOG2Ne7
+AZURE_TTS_API_KEY_0=adae11ef11d94aa98f31b2c233c1be7a
 AZURE_TRANSLATE_API_KEY=cef76c262b9b4eecab57c84695081c67
 
 BACKPACK_LOCALES=en,fr
index 18d06b078f90a0a38fe9b1e67810761e98f77acf..f5e1355d9a9cd404e66e30dc2ff9a8edd4f595f6 100644 (file)
@@ -132,14 +132,25 @@ trait Accessibility
 
     protected function _azureTTS($text, $locale, $gender, $voiceName, $output)
     {
+        if(!$text){
+            return;
+        }
+        $api = new \Cubist\Azure\TTS\Api(env('AZURE_TTS_API_KEY'));
         try {
-            $api = new \Cubist\Azure\TTS\Api(env('AZURE_TTS_API_KEY'));
             $api->textToSpeech($text, $locale, $gender, $voiceName, $output);
-            if (!file_exists($output) || filesize($output) < 100) {
-                throw new Exception('Error while making tts (' . $output . ') : ' . $text . ', ' . $locale . ', ' . $gender . ', ' . $voiceName);
-            }
         } catch (Exception $e) {
+            $message = $e->getMessage();
         }
+        if (!file_exists($output) || filesize($output) < 100) {
+            if (file_exists($output)) {
+                if (!isset($message)) {
+                    $message = file_get_contents($output);
+                }
+                unlink($output);
+            }
+            throw new Exception('Error while making tts (' . $output . ') : ' . $text . ', ' . $locale . ', ' . $gender . ', ' . $voiceName . ' // ' . ($message ?? ""));
+        }
+
     }
 
     public function getLinkAlternativeText($link, $returnJobs = false)