Html Video

Video in Html is used by placing embed tag for include external plugin like flash player, media player into your web page. Embed tag contain the following attributes.

The video Tag

As you’ll recall, in HTML5 embedding video essentially comes down to using a single tag: video. But as with any HTML tag, you have a lot of options for parameters. Here are the essentials within the tag itself: src: the location and name of the source video, it works the same as the src parameter for the img tag. Note, however, that rather than identifying the video source here, you can, and probably should, do that outside the tag.

Attributes

  1. src
  2. height
  3. weight
  4. autoplay
  5. playcount
  6. loop

Examle

<html>
<head>
<title>
Codingknack
</title>
</head>
<body>
<video width=”400″ controls>
<source src=”codingknack%20intro.mp4″ type=”video/mp4″>
</video>
</body>
</html>

video-in-html

OUTPUT

display-video-in-html

Playing video in Html

Before HTML5, a video could only be played in a browser with a plug-in (like flash).

How it Works

The controls attribute adds video controls, like play, pause, and volume. It is a good idea to always include width and height attributes. If height and width are not set, the page might flicker while the video loads. The element allows you to specify alternative video files which the browser may choose from. The browser will use the first recognized format. The text between the  video tags will only be displayed in browsers that do not support the video.

HTML Video - Methods, Properties, and Events

HTML5 defines DOM methods, properties, and events for the <video> element. This allows you to load, play, and pause videos, as well as setting duration and volume. There are also DOM events that can notify you when a video begins to play, is paused, etc.

Chrome Firefox IE Opera Safari Android
   Yes  Yes Yes   Yes Yes Yes

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Close Menu