1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<!DOCTYPE html>
<html>
<head>
<title>Matt's awful video player</title>
<script>
  function startPlay()
   {
 var v = document.getElementById("vid");

 // something pressed the button, so let's query the state
 // of the video and react accordingly
 if (v.paused) {
   // if the video is stopped/paused, then let's play it.
   v.play();
 } else {
   // if the video is playing, then let's pause it.
v.pause();

   }
}
</script>
</head>
<body>

 <video id="vid" src="octopus.ogv"
              width="360" height="240"></video>

 <p><button onclick="startPlay();">Start Playing!</button><p>

</body>
</html>