Quackit Logo

Got a MySpace Page?

Get "www.yourname.com" for your MySpace page. Learn how >>.

HTML Video Codes

Print Version

So you've made a video, you've uploaded it to a web server on the Internet, and now you want to show it to your users?

No problem! This page provides you with all the code you need to do the job!

Linking to a video file

The easiest way to include video on your website is to link to it. This is suitable if you don't want to actually embed the video within your HTML page. You can link to a video file using the <a href= tag. All you need to do is write something like this:

<a href="http://video.google.com/googleplayer.swf?docId=4923697466556084028&hl=en">Watch this video</a>

This results in:

This assumes that the video file is in the specified location.

Embedding a video file

It's likely that you'd prefer to embed the video file into your web page.

You can embed HTML video code into your web page using the embed tag. Although the embed tag isn't actually part of the HTML specification, it is widely supported by the major browsers.

<embed
	style="width:400px; height:326px;"
	id="VideoPlayback"
	type="application/x-shockwave-flash"
	src="http://video.google.com/googleplayer.swf?docId=4923697466556084028&hl=en">
</embed>

This code embeds a video from Google Videos into the web page. Google uses Shockwave (or Flash) to present the video controls. You could just as easily embed a different video format and the user's browser should use the appropriate plugin to display the video and it's controls.

The <embed> Tag's Attributes

AttributeDescriptionPossible Values
autostartDetermines whether to start the video as soon as the page has loaded.
  • True
  • False
hiddenDetermines whether to hide the video. For example, if you just want background noise with no video.
  • True
  • False
loopDetermines whether to continously replay the video after it has finished.
  • True
  • False
playcountDetermines how many times to repeat the video.A number value
volumeDetermines how loud the audio should be.Number value between 1 and 100

Video Formats

Some of the more common video formats are:

  • .swf - Shockwave/Flash File (by Macromedia/Adobe)
  • .wmv - Windows Media Player video format (by Microsoft)
  • .mov - Quicktime video format (by Apple)
  • .mpeg - Video compression format (specified by the Moving Pictures Experts Group)

You should also check out the HTML object tag which is the W3C standard for adding media to your HTML.

Have you checked out the HTML Tutorial?

Enjoy this website?

  1. Link to this page (copy/paste into your own website or blog):
  2. Add this page to your favorite social bookmarks sites:
                     
  3. Add this page to your Favorites

Oh, and thank you for supporting Quackit!