Ajout d'un bouton et d'un player audio sur la page d'acceuil pour
Some checks failed
/ build (push) Failing after 1s
Some checks failed
/ build (push) Failing after 1s
streamer la radio de l'interhack
This commit is contained in:
parent
3c36572ce1
commit
fa10dffd96
5 changed files with 63 additions and 4 deletions
23
js/radio.js
Normal file
23
js/radio.js
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
// Code Javascript pour la radio du Camp Interhack
|
||||
// Hébergé par P-Node
|
||||
// Propulsé par le Radio Operation Center
|
||||
// En live depuis l'Antenne
|
||||
|
||||
const radioPlayer = document.getElementById("radio-player");
|
||||
const audio = document.querySelector('audio');
|
||||
const radioButton = document.getElementById("radio-button");
|
||||
|
||||
let state = "paused" // Can be : "playing" or "paused"
|
||||
|
||||
radioPlayer.addEventListener('click', () => {
|
||||
if(state == "paused"){
|
||||
state = "playing";
|
||||
audio.play();
|
||||
radioButton.innerHTML = '<img src="assets/pause-solid-full.svg" alt="pause button">';
|
||||
|
||||
} else {
|
||||
state = "paused"
|
||||
audio.pause();
|
||||
radioButton.innerHTML = '<img src="assets/play-solid-full.svg" alt="play button">';
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue