In this recipe, you will be introduced to another element of HTML5, <video>
.
To embed video, we need the video tag, and to work on it, we need the canvas API. The output of this recipe looks like this:
The recipe is as follows:
The HTML code:
<html> <head> <title>Video</title> </head> <body> <center> <video id="myVideo" autoplay="true" loop="true" width=200 height=200> <source src="happynewyear.mp4" type="video/mp4"/> The browser doesn't support video </video> <h1>A Video</h1> </center> </body> </html>
It's the video tag that does the trick. The video is played in a loop, and there are no controls available to pause or stop the video. If you need to see the controls, add the attribute controls to the video element (<video controls id="myVideo" …..
).
One important point to remember is that your webserver MIME types should list the type of...