English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML reference manual

HTML tag大全

HTML: <video> src attribute

The usage of <video> src attribute, the src attribute specifies the location of the video file (URL), to play video in Internet Explorer and Safari, we must use MPEG4file.

 HTML <video> tag

Online examples

Play video online:

<video src="movie.ogg" controls>
  Your browser does not support the video tag.
</video>
Test to see ‹/›

Browser compatibility

IEFirefoxOperaChromeSafari

All major browsers support the src attribute, but not all browsers support the defined file formats

Note: Internet Explorer 8 and earlier IE versions do not support the <video> tag.

Definition and usage

The src attribute specifies the location of the video file (URL).
The above example uses Ogg files and will run on Firefox, Opera, and Chrome.
To play video in Internet Explorer and Safari, we must use MPEG4file.

To make it work on all browsers- Inside the <video> element <source> Elements. <source> Elements can link to different video files. Browsers will use the first recognizable format:

Online examples

<video width="380" height="260" controls>
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
  Your browser does not support the video tag.
</video>

HTML 4.01 with HTML5differences

<video> tag is part of HTML5 New tag.

Syntax

<video src="URL">

Attribute value

ValueDescription
URL

URL of the video file.

Possible values:

  • Absolute URL - Points to another site (for example href="http://www.example.com/song.ogg")

  • Relative URL - Points to a file within the website (for example href="song.ogg")

 HTML <video> tag