Latest web development tutorials
 

Video poster Property

< Video Object

Example

Change the poster image of a video:

document.getElementById("myVideo").poster = "/images/w3iicomlogo.png";
Try it Yourself »

Definition and Usage

The poster property sets or returns the value of the poster attribute of a video.

The poster attribute specifies an image to be shown while the video is downloading, or until the user hits the play button. If this is not included, the first frame of the video will be used instead.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The poster property is supported in all major browsers.

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


Syntax

Return the poster property:

videoObject.poster

Set the poster property:

videoObject.poster=URL

Property Values

Value Description
URL Specifies the URL of the image file.

Possible values:

  • An absolute URL - points to another web site (like href="http://www.example.com/poster.jpg")
  • A relative URL - points to a file within a web site (like href="poster.jpg")

Technical Details

Return Value: A String, representing the URL of the poster image. Returns the entire URL, including the protocol (like http://)

More Examples

Example

Get the URL of the poster image:

var x = document.getElementById("myVideo").poster;

The result of x will be:

http://www.w3ii.com/jsref/w3javascript.gif
Try it Yourself »

Related Pages

HTML reference: HTML <video> poster attribute


< Video Object