Created
May 19, 2013 17:41
-
-
Save sibsfinx/5608378 to your computer and use it in GitHub Desktop.
w3schools html5 video example
This file contains 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
<h2 class="example">Example 1</h2> | |
<p class="example">Create simple play/pause + resize controls for a video:</p> | |
<div class="example_code notranslate"> | |
<br> | |
<div style="text-align:center"> | |
<button onclick="playPause()">Play/Pause</button> | |
<button onclick="makeBig()">Big</button> | |
<button onclick="makeSmall()">Small</button> | |
<button onclick="makeNormal()">Normal</button> | |
<br><br> | |
<video id="video1" width="480"> | |
<source src="mov_bbb.mp4" type="video/mp4"><source src="mov_bbb.ogg" type="video/ogg">Your browser does not support HTML5 video. | |
</video> | |
</div> | |
<script> | |
var myVideo=document.getElementById("video1"); | |
function playPause() | |
{ | |
if (myVideo.paused) | |
myVideo.play(); | |
else | |
myVideo.pause(); | |
} | |
function makeBig() | |
{ | |
myVideo.width=600; | |
} | |
function makeSmall() | |
{ | |
myVideo.width=320; | |
} | |
function makeNormal() | |
{ | |
myVideo.width=480; | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment