HTML and video and src properties

HTML video src attribute HTML and video. Tags

The src property is used to place the path source of the video you need to play, as follows:

Play a video:

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

Try it out . . .

Browser support

HTML video src attribute HTML video src attribute HTML video src attribute HTML video src attribute HTML video src attribute

Src properties are supported by all major browsers. However, the defined file format is not supported by all browsers.

Note: Internet Explorer 8 and earlier versions of IE do not support the label.


Definitions and usages

The src property specifies the local path (URL) of the video file.

The above example uses the Ogg file, which works well on Firefox, Opera, and Chrome.

If you need to play videos on Internet Explorer and Safari, you must use an MPEG4 file.

If you want to play a video file in all browsers - you can use the total use of the element in the .lt;source?gt; element. E lements can be linked to different video files. The browser will use the first recognizable format:

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

Try it out . . .


The difference between HTML 4.01 and HTML5

The label is a new HTML5 label.


Grammar

<video src=" URL ">

The property value

value describe
URL

The URL of the video file.

Possible value:

  • Absolute URL - pointing to another site (such as href = "http://www.example.com/song.ogg" Rel = "external nofollow" target = "_ blank")
  • Relative URL - pointing to files within the website (such as href = "song.ogg")


HTML video src attribute HTML and video. Tags

Related articles

HTML DOM Reference Manual: HTML DOM Video src property