- 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 played Property
The HTML DOM Video played property returns a TimeRanges object containing information about the video’s played range length and its start, end position.
Syntax
Following is the syntax −
Returning TimeRanges Object
mediaObject.played
Let us see an example of Video played property −
Example
<!DOCTYPE html> <html> <head> <title>HTML DOM Video played</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-played</legend> <video id="demo" width="320" controls><source src="http://www.tutorialspoint.com/html5/foo.mp4" type="video/mp4"></video><br> <input type="button" onclick="getTrackDetails()" value="How much free view time is left?"> <div id="divDisplay"></div> </fieldset> </form> <script> var divDisplay = document.getElementById("divDisplay"); var demo = document.getElementById("demo"); demo.autoplay =true; var limit = 5; function getTrackDetails() { divDisplay.textContent = 'You have '+(limit - demo.played.end(0))+' seconds left'; } </script> </body> </html>
Output
Clicking ‘How much free view time is left?’ button with playing video −
Clicking ‘How much free view time is left?’ button after playing video for some seconds −
Advertisements
To Continue Learning Please Login
Login with Google