HTML <video> src Attribute

Definition and Usage

src The attribute specifies the location (URL) of the video file.

The above example uses an Ogg file, which works in Chrome, Edge, Firefox, and Opera.

To play video in older versions of Internet Explorer and Safari, we must use MPEG4 files.

To make it work in all browsers - please add multiple within the <video> element <source> elementEach <source> element can link to a different video file. The browser will use the first format it recognizes.

<video width="640" height="360" controls>
  <source src="shanghai.mp4" type="video/mp4">
  <source src="shanghai.ogg" type="video/ogg">
  Your browser does not support the video tag.
</video>

Try It Yourself

Example

Play Video:

<video src="shanghai.mp4" controls>
  Your browser does not support the video tag.
</video>

Try It Yourself

Syntax

<video src="URL">

Attribute Value

Value Description
URL

URL of the video file.

Possible values:

  • Absolute URL - Points to another website (e.g., src="http://www.example.com/movie.ogg")
  • Relative URL - Points to a file within the website (e.g., src="shanghai.ogg")

Browser Support

The numbers in the table indicate the first browser version that fully supports this attribute.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
4.0 9.0 3.5 3.1 11.5

All mainstream browsers support src Attributes, but not all browsers support the defined file formats.