Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 currentTime Property
The HTML DOM Video currentTime property returns/sets the current position of seeker (in seconds) of media.
Following is the syntax −
Returning seeker position
mediaObject.currentTime
Setting currentTime to seekable position
mediaObject.currentTime = seconds
Let us see an example of Video currentTime property −
Example
<!DOCTYPE html>
<html>
<head>
<title>HTML DOM Video currentTime</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-currentTime</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="Jump some seconds">
<div id="divDisplay"></div>
</fieldset>
</form>
<script>
var divDisplay = document.getElementById("divDisplay");
var demo = document.getElementById("demo");
function getTrackDetails() {
demo.currentTime = '15';
divDisplay.textContent = 'Some Seconds Avoided';
}
</script>
</body>
</html>
Output
Before clicking ‘Jump some seconds’ button −

After clicking ‘Jump some seconds’ button −

Advertisements