Код: Выделить всё
function speakText() {
const item = vocabulary[currentVocabularyIndex];
var text = item.arabic;
if(problemWords.includes(text) == true){ // Special case
console.log("Special voice case for this word (" + text + ")");
const audioFile = new Audio('/specialCaseAudioFiles/' + item.transliteration + '.mp3');
audioFile.play();
} else {
const utterance = new SpeechSynthesisUtterance(text);
utterance.lang = 'ar-SA'; // Set the language to Saudi Arabian Arabic
utterance.rate = 0.8;
if ('speechSynthesis' in window) {
window.speechSynthesis.cancel();
window.speechSynthesis.speak(utterance);
} else {
console.log("Speech synthesis not supported in this browser.");
}
}
}
Я ИСПОЛЬЗОВАЛ ХРОМ НА ТЕЛЕФОНАХ SAMSUNG, А НЕ SAMSUNG INTERNET
Подробнее здесь: https://stackoverflow.com/questions/786 ... ung-chrome