I'm making my first steps in coding using online training. For some reasons the code for MP3 player provided in training does not work.
I wrote same code in Brackets and it does not fly. It shows buttons, but when I press them nothing is happening.
Can please someone help me what is the reason for that? Both mp3 file and html file are placed on desktop.
<html>
<head>
<title>Video Player</title>
<script>
var player;
window.onload=function()
{
player = document.getElementById("sound");
document.getElementById("btnPlay").addEventListener("click", playMusic, false);
document.getElementById("btnPause").addEventListener("click", pauseMusic, false);
document.getElementById("btnStop").addEventListener("click", stopMusic,false);
}
function playMusic()
{
player.play();
}
function pauseMusic()
{
player.pause();
}
function stopMusic()
{
player.pause();
player/currentTime=0;
}
</script>
</head>
<body>
<audio id="sound">
<source src="mlynarz.mp3" />
</audio>
<button id="btnPlay">Play</button>
<button id="btnPause">Pause</button>
<button id="btnStop">Stop</button>
</body>
</html>