HTML | DOM Video poster Property
The Video poster property is used for setting or returning the value of the poster attribute of a video. The poster attribute is specifically used to display an image while the video is being downloaded, or until the play button is hit by the user.
The first frame of the video is displayed if the poster option is not included.
Syntax:
Return the poster property:
videoObject.poster
Set the poster property:
videoObject.poster = URL
Property Values
- URL : It is used to specify the URL of the image file.
Below program illustrates the Video Poster property :
Example: Changing the poster image of a video.
<!DOCTYPE html> < html > < head > < title >DOM Video poster Property</ title > </ head > < body style = "text-align:center" > < h1 style = "color:green" > GeeksforGeeks </ h1 > < h2 style = "font-family: Impact" > Video Poster Property </ h2 > < br > < video id = "Test_Video" width = "360" height = "240" poster = "gfg_200X200.png" controls> < source src = "samplevideo.mp4" type = "video/mp4" > < source src = "movie.ogg" type = "video/ogg" > </ video > < p >To change the poster image, double click the "Change Poster" button.</ p > < button ondblclick = "My_Video()" type = "button" >Change Poster</ button > < script > function My_Video() { document.getElementById( "Test_Video").poster = "Unknown.png"; } </ script > </ body > </ html > |
Output:
Before clicking the button::
After clicking the button:
Supported Browsers:
- Apple Safari
- Internet Explorer
- Firefox
- Google Chrome
- Opera
Recommended Posts:
- HTML | <video> poster Attribute
- HTML | poster Attribute
- HTML | DOM Video src Property
- HTML | DOM Video currentSrc Property
- HTML | DOM Video controls Property
- HTML | DOM Video defaultPlaybackRate Property
- HTML | DOM Video loop Property
- HTML | DOM Video seekable Property
- HTML | DOM Video width Property
- HTML | DOM Video duration Property
- HTML | DOM Video startDate Property
- HTML | DOM Video currentTime Property
- HTML | DOM Video defaultMuted Property
- HTML | DOM Video controller Property
- HTML | DOM Video preload Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.