Video posterProperty

Video 对象参考手册Video Object

Example

Change the image displayed when the current video data is invalid:

document.getElementById("myVideo").poster="/images/logo2.png";

Try it Yourself »

Definition and Usage

The poster property is used to set or return the poster attribute value of a video.

The poster attribute describes the image displayed while the video is loading or before the user clicks the play button. If this attribute is not included, the first frame of the video will be displayed instead.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the poster attribute.

Note:Internet Explorer 8 and earlier IE 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 Describes the URL address of the image file.

Possible values:

  • Absolute URL - points to another site (e.g. href="http://www.example.com/poster.jpg")
  • Relative URL - points to a file within the site (e.g. href="poster.jpg.html")

Technical Details

Return value: A string representing the URL of the preview image. Returns an absolute URL, including the protocol (http://).


More Examples

Example

Get the URL of the preview image:

var x = document.getElementById("myVideo").poster;
xOutput:
http://www.example.com/images/logo.png

Try it Yourself »


Related Pages

HTML Reference Manual:HTML <video> poster Attribute


Video 对象参考手册Video Object Other Extensions