Video poster Property
Example
Change the poster image of a video:
document.getElementById("myVideo").poster = "/images/w3schoolscomlogo.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
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:
|
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.w3schools.com/jsref/w3javascript.gif
Try it Yourself »
Related Pages
HTML reference: HTML <video> poster attribute
Video Object