diff --git a/AudioPlayer/audio-file.mp3 b/AudioPlayer/audio-file.mp3 new file mode 100644 index 0000000..ab94045 Binary files /dev/null and b/AudioPlayer/audio-file.mp3 differ diff --git a/AudioPlayer/audioPlayer.js b/AudioPlayer/audioPlayer.js new file mode 100644 index 0000000..b43eb12 --- /dev/null +++ b/AudioPlayer/audioPlayer.js @@ -0,0 +1,35 @@ +document.addEventListener("DOMContentLoaded", function () { + const audio = document.getElementById("audio"); + const playPauseButton = document.getElementById("playPause"); + const stopButton = document.getElementById("stop"); + const volumeUpButton = document.getElementById("volumeUp"); + const volumeDownButton = document.getElementById("volumeDown"); + + playPauseButton.addEventListener("click", function () { + if (audio.paused) { + audio.play(); + playPauseButton.innerHTML = "Pause"; + } else { + audio.pause(); + playPauseButton.innerHTML = "Play"; + } + }); + + stopButton.addEventListener("click", function () { + audio.pause(); + audio.currentTime = 0; + playPauseButton.innerHTML = "Play"; + }); + + volumeUpButton.addEventListener("click", function () { + if (audio.volume < 1.0) { + audio.volume += 0.1; + } + }); + + volumeDownButton.addEventListener("click", function () { + if (audio.volume > 0.0) { + audio.volume -= 0.1; + } + }); +}); diff --git a/AudioPlayer/index.html b/AudioPlayer/index.html new file mode 100644 index 0000000..356dae6 --- /dev/null +++ b/AudioPlayer/index.html @@ -0,0 +1,22 @@ + + + + + Simple Audio Player + + + +

Simple Audio Player

+ + + + + + + + + + \ No newline at end of file