Embedding Video to HTML File

How a video file can be embedded into a webpage?
How to add a media player into HTML files?

Explanation

HTML embedding video in IE:
Adding a media player to HTML page is simple using the embed tag. Mostly the embed element is used for embedding video files into the html pages. We can also use the DYNSRC attribute of the image element for adding media file. It works only in the Internet explorer.
Example :
<IMG DYNSRC="ourmovie.mov" LOOP="true" WIDTH="200" HEIGHT="100">

HTML embedding using the embed element:
Just use <EMBED> tag to add video

Example :

<EMBED SRC="mymovie.mov" WIDTH="200" HEIGHT="100" AUTOPLAY="TRUE" LOOP="true"></EMBED>

This will include a media file into your webpage.
Result:

Attributes of Embed Tag:
  • SRC: This attribute takes the video/movie to the source URL.

  • WIDTH and HEIGHT: It specifies the dimensions of the plug-ins.

  • AUTOPLAY: Its value can be either TRUE or false
    TRUE: Movie plays when page loads
    FALSE: Waits for the user to click the play button in window media player.

  • LOOP: Setting this to TRUE will play the media file continuously. A FALSE value will play the media only once.

  • CONTROLLER: Display controls. Can be set to TRUE or FALSE.

Adding video using Object Tag:
Video files can also be inserted into the webpage or html pages using the standard object tag. Object element works in both IE and netscape browsers. For some types, like QuickTime document, adding the classid attribute will load the controls.

Example :

<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="320" height="240">
<param name="src" value="data/intro.wmv" >
<param name="controller" value="true" >
<param name="autoplay" value="false">
<object type="video/quicktime" data="data/intro.wmv" width="320" height="240">
<param name="controller" value="true" >
<param name="autoplay" value="false">
alt : <a href="intro.wmv">test movie</a>
</object>
</object>

Result:


alt : test movie
Note:If your browser supports this object tag, video will display or you have to click on the link to view the video.

Ask Questions

Ask Question