I have 2 audio file with 2 button with it, the first one src is from my local file and the second is from another website.
var audio = document.getElementById('audio');
var button = document.getElementById('button');
var audio2 = document.getElementById('audio2');
var button2 = document.getElementById('button2');
button.addEventListener('click', function() {
audio.currentTime = audio.currentTime + 5;
});
button2.addEventListener('click', function() {
audio2.currentTime = audio2.currentTime + 5;
});
<!--AUDIO LOCAL-->
<audio controls id="audio">
<source src="kiminoyoruwokure.mp3">
</audio>
<button id="button">Change the Current Time + 5</button>
<!--AUDIO LINK -->
<audio id="audio2" controls>
<source src="https://commondatastorage.googleapis.com/codeskulptor-assets/Epoq-Lepidoptera.ogg">
</audio>
<button id="button2">Change the Current Time + 5</button>
When i clicked on the first button, the audio gonna start from 0 (like a reloading or smt like that), while the 2nd worked fine.
I cant even change the value of the Seek bar (dont sure what to call it). for example, the video is play at 5s, i clicked the seek bar to 10s and it gonna move back to 5s
It worked on a .html file but not a .php
Nanaya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
8