---
title: "Video element in HTML5"  
description: "Today most videos are shown by plug-ins like flash or Silverlight but all browsers did not support same plug-ins. HTML5 specifies a standard way to su"  
author: "Anonymous User"  
published: 2011-07-21  
updated: 2020-03-04  
canonical: https://www.mindstick.com/articles/577/video-element-in-html5  
category: "html5"  
tags: ["html5"]  
reading_time: 2 minutes  

---

# Video element in HTML5

Today most videos are shown by plug-ins like flash or [Silverlight](https://www.mindstick.com/blog/54/silverlight-in-asp-dot-net) but all browsers did not [support](https://yourviews.mindstick.com/view/81072/pakistan-wants-enmity-not-support-from-india-during-coronavirus-pandemic) same plug-ins. [HTML5](https://www.mindstick.com/articles/1535/offline-add-edit-delete-data-in-html5-indexeddb) specifies a [standard](https://www.mindstick.com/articles/23223/naming-convention-or-coding-standard) way to support video using video element. The [formats](https://www.mindstick.com/forum/160705/explain-the-concept-of-datetime-formats-in-c-sharp) which are supported by video [elements](https://www.mindstick.com/forum/1440/wpf-button-with-multiple-text-elements) are Ogg, MPEG4 or WebM.\

1. **Ogg** = Ogg files with theora video codec and vorbis audio codec.
2. **MPEG4**=MPEG4 files with H.264 video codec and AAC audio codec.
3. **WebM**=WebM files with VP8 video codec and vorbis audio codec.

##### Syntax

#### <video src=”file name with location” controls=”controls to be used”></video>

##### Video attributes:

1. **src**: In this [attribute](https://www.mindstick.com/blog/61/ado-dot-net-object-model-and-attributes) we have to pass the source of movie clip.
2. **Width**: In this attribute we can pass width of video.
3. **Loop**: If video has finished it will start again.
4. **Height**: Set the height of the video.
5. **Poster**: Video image that specifies the video.
6. **Autoplay**: Specifies whether or not to start playing the video as soon as it can do so without stopping.
7. **Preload**: Specifies video should be preloaded or not.
8. **[Controls](https://www.mindstick.com/articles/66/how-to-create-controls-at-run-time-in-csharp-dot-net)**: Specifies [control](https://yourviews.mindstick.com/view/83439/bipartisan-gun-control-bill-passed-in-us-after-decades) [button](https://www.mindstick.com/articles/63/how-to-add-button-in-datagridview-in-csharp-dot-net) display(play, pause or stop button etc).

##### Following sample represent use of video element in html5

```
<!DOCTYPE HTML>       <html><body>     <video width="600" height="300" controls="controls">       <source src="Video/sample.mp4" type="video/mp4" />            </video></body></html>
```

##### Output of following code snippet is as follows

![Video element in HTML5](https://www.mindstick.com/mindstickarticle/59963a7f-031c-4eb1-aad8-366be3b3b1d2/images/1f19922a-475e-4d82-9c33-b22a671bd785.png)

Note: This code snippet is supported by Google Chrome and Mozilla Firefox4

\

---

Original Source: https://www.mindstick.com/articles/577/video-element-in-html5

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
