to home page

BWRS
SEARCH

HOMETUTORIALSLINKSFORUMGLOSSARYNEWS
 

HTML VIDEO TAGS

HTML VIDEO  

There are 2 ways to add video to your web page

As A Link

"Embedded" into page


Linked Video

The safest and easiest way to add a video to web page is to use a link.

It avoids any issues of browser incompatibilities in understanding embedded video files (although your viewer still need the appropriate helper application, consider the following

Click here to see me use a mouse

can't view it download quicktime now

This is simply coded for by


<a href="mouse2.mov" target="_blank">
Click here to see me move a mouse
</a>

Instead of the link being pointed at a webpage it is aimed directly at the movie file mouse2.mov.

The target="_blank" attribute opens the movie in a new window (for more on this)

Note we've included a link for a helper application
(quicktime from Apple at - http://quicktime.apple.com/)

That's all you need to do it !!!


Embedded video

Many people like "embedding" video into their webpages so it appears part of the page's fabric


As we've said before give your audience the option of seeing movie files or not so a make a link to the page containing the movie

However we'd just like to remind you thing are much more stable if you use a link to open a video (see here) rather than embedding it.

We've found lots of problems of browser incompatibilities but here is a run through of the major ways to embed files

(1) Using The <img> tag (Internet explorer only)

This is a great set of commands to embed a video. Sadly it only works for Microsoft's browsers. Click below to see it


 

<img dynsrc="mouse.avi"
width=160 height=120
start="fileopen" loop="infinite"
alt="sorry some users this don't work see this">

 

Okay lets break that down. The first line tells the browser to load the video called mouse.avi. The second sets the area it will occupy (careful this may stretch your image).

The next line is very important.

The attribute start means the file will start playing as soon as loaded (fileopen). Alternative value would include "mouseover" (when the mouse crosses the image)

Loop on the other hand controls how many times the file will play round. Set a value or infinite

(2) The <embed> tag

This is gradually being phased out in favour of the <object> tag. However it's still one of the best ways to embed video files. We find it works with navigator and explorer when using .mov files (most people will have quicktime player or some other plug-in for these browsers) but curiously not .avi


<embed src="mouse.mov"
pluginspage="http://quicktime.apple.com/"
width=192 height=168
loop="true" controller="true" autoplay="false"
alt="Mouse.mov. You need quicktime plug in for this to work">
</embed>

Lets run through the code. The <embed> tag tells the browser to load and embed our file called mouse.mov.

Pluginspage lets a browser without the required plugin display a link to a suitable download site (here http://quicktime.apple.com/). Width and height control the plugin window size on the browser (but don't stretch images)

The next 3 attributes are key. Loop tells tell the browser to either repeatedly loop (true),play a no of times (enter a no e.g. "3") or not to loop (false). Controller determines if controls are present (true) or not (false). Whilst autostart determines if the file will autostart (true or false)

The alt is simply added for an alternate message (please put it in for visually impaired people)

The embed tag is a pretty safe way of doing things and although will be depreciated will be usable for some time after that even on the latest browser.

 

(3) The <object> tag

The second is the use of a tag called <object>. This is a jack of all trades tag and allows you to use many items called objects on a web page which include things like video video and will eventually replace the<embed> (and the<applet> tag)

Guess what ? Sadly at the moment you'll need quite a lot of code to get this up and running and certainly the code concerned is not easily explainable

We've mentioned this primarily for the future. Some advocate the use of multiple tags to cover all eventualities but you run the risk of getting numerously simultaneous file run interfering with each other.

At the end of the day we still sadly say you're safer off using Links