Created
May 23, 2012 17:12
-
-
Save hltbra/2776437 to your computer and use it in GitHub Desktop.
watch_html5_player.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <!-- written by Hugo Lopes Tavares --> | |
| <html> | |
| <head> | |
| <style> | |
| #content { | |
| margin: 0 auto; | |
| text-align: center; | |
| } | |
| #controls * { | |
| font-size: 2.5em; | |
| } | |
| #slower, #play, #pause { | |
| margin-left: 5em; | |
| } | |
| #url { | |
| width: 60%; | |
| } | |
| </style> | |
| <title>Watch html5 videos</title> | |
| </head> | |
| <body> | |
| <div id="content"> | |
| <div> | |
| <label for="url">Video URL:</label> | |
| <input type="text" value="" id="url" /> | |
| <input type="submit" value="CHANGE VIDEO" id="change" /> | |
| </div> | |
| <video id="myvideo" controls="controls"> | |
| </video> | |
| <div id="controls"> | |
| <a href="#" id="faster">faster</a> | |
| <a href="#" id="slower">slower</a> | |
| </div> | |
| </div> | |
| <script type="text/javascript"> | |
| var myvideo = document.getElementById("myvideo"); | |
| myvideo.defaultPlaybackRate = 1.0; | |
| myvideo.playbackRate = 1.0; | |
| document.getElementById("change").onclick = function(){ | |
| myvideo.src = document.getElementById("url").value; | |
| }; | |
| document.getElementById("faster").onclick = function(){ | |
| myvideo.playbackRate += 0.4; | |
| }; | |
| document.getElementById("slower").onclick = function(){ | |
| myvideo.playbackRate -= 0.4; | |
| }; | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment