- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
HTML DOM Video poster Property
The HTML DOM Video poster property returns/sets a string corresponding to the url of an image shown until the video is played or network state is equal to ‘2’.
Syntax
Following is the syntax −
Returning string value
mediaObject.poster
Setting poster to a URLString
mediaObject.poster = URLString
Let us see an example of HTML DOM Video poster property −
Example
<!DOCTYPE html> <html> <head> <title>HTML DOM Video poster</title> <style> * { padding: 2px; margin:5px; } form { width:70%; margin: 0 auto; text-align: center; } input[type="button"] { border-radius: 10px; } </style> </head> <body> <form> <fieldset> <legend>HTML-DOM-Video-poster</legend> <video id="demo" width="320" controls><source src="http://www.tutorialspoint.com/html5/foo.mp4" poster='' type="video/mp4"></video><br> <input type="button" onclick="getTrackDetails()" value="Get Poster URL"> <div id="divDisplay"></div> </fieldset> </form> <script> var divDisplay = document.getElementById("divDisplay"); var demo = document.getElementById("demo"); function getTrackDetails() { if(demo.poster === '') divDisplay.textContent = 'No Poster, 1st frame of video used as poster'; else divDisplay.textContent = 'Poster URL: '+demo.poster; } </script> </body> </html>
Output
Before clicking ‘Get Poster URL’ button −
After clicking ‘Get Poster URL’ button −
Advertisements