Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>html5video</title>
- <link rel="stylesheet" type="text/css" href="html5v2.css">
- </head>
- <body>
- <video autoplay id="video">
- <source src="movies/39steps_mit_subs.webm">
- I just can't :(
- </video>
- <script>
- var video = document.getElementsById('video');
- video.onpause = video.onplay = function(e) {
- playpause.value = video.paused ? 'Play' : 'Pause';
- }
- function playOrPause() {
- if (video.ended || video.paused) {
- video.play();
- } else {
- video.pause();
- }
- }
- var seekbar = document.getElementById('seekbar');
- function setupSeekbar() {
- seekbar.min = video.startTime;
- seekbar.max = video.startTime + video.duration;
- }
- video.ondurationchange = setupSeekbar;
- function seekVideo() {
- video.currentTime = seekbar.value;
- }
- function updateUI() {
- seekbar.value = video.currentTime;
- }
- seekbar.onchange = seekVideo;
- video.ontimeupdate = updateUI;
- </script>
- <input type="button" value="Play" id="playpause" onclick="playOrPause()">
- <input type="range" step="any" id="seekbar">
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement