switching to separate source element for the audio tag

This commit is contained in:
mb 2022-09-21 15:37:58 +02:00
parent 69ea8bb846
commit a76baa5882

View File

@ -130,36 +130,30 @@
<!-- PLACEHOLDER link: https://vvvvvvaria.org/logs/zamopuzo/audio/varia_broadcasts_jingle1.mp3 <!-- PLACEHOLDER link: https://vvvvvvaria.org/logs/zamopuzo/audio/varia_broadcasts_jingle1.mp3
previous audio cast: https://stream.w-i-t-m.net/meander --> previous audio cast: https://stream.w-i-t-m.net/meander -->
<div class="audio-stream fullscreen" id="showAudio"> <div class="audio-stream fullscreen" id="showAudio">
<audio id="player" preload="none" src="https://voice.vvvvvvaria.org/live"> </audio> <audio id="player" preload="none">
<source src="https://voice.vvvvvvaria.org/live" type="audio/mpeg">
Your browser does not support the audio element. Try the direct link to the audio below!
</audio>
<p> <p>
Press play to tune in! It might take a few seconds to load.</p> Press play to tune in! It might take a few seconds to load.</p>
<div class="audio-buttons"> <div class="audio-buttons">
<button id="audio" class="stream-button b-narrow" onclick="Play()">Play</button> <button id="audioButton" class="stream-button b-narrow" onclick="Play()">Play</button>
<!-- <button id="bp" class="stream-button b-narrow" onclick="document.getElementById('player').play(); bplaytoggle()">Play</button> -->
<!-- <button id="bs" class="stream-button b-narrow" onclick="console.log(soundEffect);">Stop</button> -->
<!-- <button id="bs" class="stream-button b-narrow" onclick="document.getElementById('player').pause();document.getElementById('player').src=document.getElementById('player').src; bstoptoggle()">Stop</button> -->
<script> <script>
var audio = document.getElementById("player"); var audio = document.getElementById("player");
audio.volume = 0.5; audio.volume = 0.6;
var butn = document.getElementById("audio"); var butn = document.getElementById("audioButton");
// butn.style.background = "url(https://uploads-ssl.webflow.com/5acdf398c6f3e7252e9a31b9/5ad9f901d9a651ff58dad03b_play.svg) no-repeat";
function Play() { function Play() {
if(audio.paused) { if(audio.paused) {
audio.play(); audio.play();
butn.innerText = "Pause"; butn.innerText = "Pause";
} }
else { else {
audio.pause(); audio.pause();
butn.innerText = "Play"; butn.innerText = "Play";
} }
} }
</script> </script>
<button class="stream-button b-narrow vol" onclick="document.getElementById('player').volume += 0.1">Vol +</button> <button class="stream-button b-narrow vol" onclick="document.getElementById('player').volume += 0.1">Vol +</button>
<button class="stream-button b-narrow vol" onclick="document.getElementById('player').volume -= 0.1">Vol -</button> <button class="stream-button b-narrow vol" onclick="document.getElementById('player').volume -= 0.1">Vol -</button>
</div> </div>