27 lines
723 B
JavaScript
Executable File
27 lines
723 B
JavaScript
Executable File
function playMe(){
|
|
const audio = document.getElementById('bgAudio');
|
|
|
|
if (audio.paused) {
|
|
audio.load();
|
|
audio.play();
|
|
audio.muted=false;
|
|
audio.setAttribute('autoplay', 'true');
|
|
audio.autoplay = true;
|
|
document.getElementById('player').style.color='blue';
|
|
// alert('Je joue');
|
|
}
|
|
else {
|
|
audio.pause();
|
|
audio.muted=true;
|
|
audio.autoplay = false;
|
|
if (audio.hasAttribute('autoplay')) {
|
|
audio.removeAttribute('autoplay');
|
|
console.log('Autoplay désactivé');
|
|
}
|
|
document.getElementById('player').style.color='#7FFF00';
|
|
// alert('Je joue plus');
|
|
}
|
|
// alert('Audio error: ' + document.getElementById('bgAudio').error);
|
|
}
|
|
|