OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <html> |
| 3 <head> |
| 4 <style type="text/css"> |
| 5 /* Make the video stretch to fill the screen. */ |
| 6 :-webkit-full-screen #fullscreenvideo { |
| 7 width: 100%; |
| 8 height: 100%; |
| 9 } |
| 10 </style> |
| 11 </head> |
| 12 <body> |
| 13 <!--This video was obtained from |
| 14 https://videos.pexels.com/videos/adventure-trip-481. It is licensed under |
| 15 Creative Commons Zero, which does not require attribution.--> |
| 16 <video controls src="road_trip_640_480.mp4" width="640" |
| 17 height="480" id="fullscreenvideo" autoplay="autoplay"> |
| 18 </body> |
| 19 <script> |
| 20 var videoElement = document.getElementById("fullscreenvideo"); |
| 21 |
| 22 function toggleFullScreen() { |
| 23 if (!document.webkitFullScreen) { |
| 24 videoElement.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT); |
| 25 } else { |
| 26 document.webkitCancelFullScreen(); |
| 27 } |
| 28 } |
| 29 |
| 30 // Pressing "Return" causes the video to enter fullscreen. |
| 31 document.addEventListener("keydown", function(e) { |
| 32 if (e.keyCode == 13) { |
| 33 toggleFullScreen(); |
| 34 } |
| 35 }, false); |
| 36 </script> |
| 37 </html> |
OLD | NEW |