let atnAudioUtterance = null;
let atnAudioPlaying = false;
function atnToggleAudio() {
if (!window.speechSynthesis) {
alert(‘Seu navegador não suporta síntese de voz. Tente Chrome, Firefox ou Edge.’);
return;
}
if (atnAudioPlaying) {
window.speechSynthesis.cancel();
atnAudioPlaying = false;
document.getElementById(‘atn-play-icon’).innerHTML = ‘▶️’;
document.getElementById(‘atn-play-btn’).style.transform = ‘scale(1)’;
} else {
const texto = “O calorão deve continuar nos próximos dias. O Instituto Nacional de Meteorologia (Inmet) decidiu manter ativo o alerta vermelho para onda de calor que atinge partes das regiões Sul, Sudeste e Centro-Oeste do Brasil. Bem como o Sul de Minas Gerais, compreendendo Uberaba, Varginha e Juiz de Fora, o Leste do Mato Grosso do Sul, incluindo Três Lagoas, e o Sul do Espírito Santo, na área de Cachoeiro de Itapemirim.”;
atnAudioUtterance = new SpeechSynthesisUtterance(texto);
atnAudioUtterance.lang = ‘pt-BR’;
atnAudioUtterance.rate = 1;
atnAudioUtterance.pitch = 1;
atnAudioUtterance.onend = function() {
atnAudioPlaying = false;
document.getElementById(‘atn-play-icon’).innerHTML = ‘▶️’;
document.getElementById(‘atn-play-btn’).style.transform = ‘scale(1)’;
};
window.speechSynthesis.speak(atnAudioUtterance);
atnAudioPlaying = true;
document.getElementById(‘atn-play-icon’).innerHTML = ‘⏸️’;
document.getElementById(‘atn-play-btn’).style.transform = ‘scale(1.1)’;
}
}
function atnChangeSpeed(rate) {
if (atnAudioUtterance) {
window.speechSynthesis.cancel();
const texto = “O calorão deve continuar nos próximos dias. O Instituto Nacional de Meteorologia (Inmet) decidiu manter ativo o alerta vermelho para onda de calor que atinge partes das regiões Sul, Sudeste e Centro-Oeste do Brasil. Bem como o Sul de Minas Gerais, compreendendo Uberaba, Varginha e Juiz de Fora, o Leste do Mato Grosso do Sul, incluindo Três Lagoas, e o Sul do Espírito Santo, na área de Cachoeiro de Itapemirim.”;
atnAudioUtterance = new SpeechSynthesisUtterance(texto);
atnAudioUtterance.lang = ‘pt-BR’;
atnAudioUtterance.rate = rate;
atnAudioUtterance.pitch = 1;
atnAudioUtterance.onend = function() {
atnAudioPlaying = false;
document.getElementById(‘atn-play-icon’).innerHTML = ‘▶️’;
};
window.speechSynthesis.speak(atnAudioUtterance);
atnAudioPlaying = true;
document.getElementById(‘atn-play-icon’).innerHTML = ‘⏸️’;
}
}
📰 Quer ler a notícia completa?
👉 Acesse a matéria original em Olhar Digital »
Conteúdo agregado automaticamente. Todo o crédito pertence a Olhar Digital.