Skip to content

Commit

Permalink
Linamp
Browse files Browse the repository at this point in the history
  • Loading branch information
rusben committed May 8, 2018
1 parent 392690e commit 03f552f
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions javascript/004-duck.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<body>

<button class="kwak">Kwak!</button>

<div class="kwak">Kwak!</div>

<audio id="kwak" src="../media/kwak.mp3"></audio>
Expand Down
19 changes: 19 additions & 0 deletions javascript/006-linamp.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Linamp</title>
</head>

<body>

<button id="btn-play">play</button>
<button id="btn-pause">pause</button>
<button id="btn-stop">stop</button>

<audio id="track" src="../media/beethoven-symphony-5.mp3"></audio>

</body>

<script type="text/javascript" src="006-linamp.js"></script>
</html>
15 changes: 15 additions & 0 deletions javascript/006-linamp.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
var track = document.getElementById("track");
var playButton = document.getElementById("btn-play");
var pauseButton = document.getElementById("btn-pause");
var stopButton = document.getElementById("btn-stop");

playButton.addEventListener("dblclick", play);
pauseButton.addEventListener("click", pause);
stopButton.addEventListener("click", stop);

function play() { track.play(); }
function pause() { track.pause(); }
function stop() {
pause();
track.currentTime = 0;
}
Binary file added media/beethoven-symphony-5.mp3
Binary file not shown.

0 comments on commit 03f552f

Please sign in to comment.