HTML DOM Video duration प्रॉपर्टी
HTML DOM Video duration प्रॉपर्टी वीडियो की लंबाई (सेकंड में) से संबंधित एक नंबर लौटाती है।
सिंटैक्स
स्ट्रिंग मान प्राप्त करना
mediaObject.duration
उदाहरण
आइए HTML DOM Video duration प्रॉपर्टी का एक उदाहरण देखें:
<!DOCTYPE html> <html> <head> <title>HTML DOM Video duration</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-duration</legend> <video id="demo" width="320" controls><source src="https://www.tutorialspoint.com/html5/foo.mp4" type="video/mp4"></video><br> <input type="button" onclick="getTrackDetails()" value="How many seconds of content is this video?"> <div id="divDisplay"></div> </fieldset> </form> <script> var divDisplay = document.getElementById("divDisplay"); var demo = document.getElementById("demo"); function getTrackDetails() { divDisplay.textContent = 'Duration: '+demo.duration+' seconds'; } </script> </body> </html>
आउटपुट
'How many seconds of content is this video?' बटन पर क्लिक करने से पहले:

'How many seconds of content is this video?' बटन पर क्लिक करने के बाद:
