Javascript DOM HTML Video startDate Property

Introduction

Get the current timeline offset of the video:

var x = document.getElementById("myVideo").startDate;

Click the button to get the current timeline offset of the video.

The startDate property is not supported in any major browsers.

View in separate window

<!DOCTYPE html>
<html>
<body>

<video id="myVideo" width="100" height="100" controls>
  <source src="video.mp4" type="video/mp4">
  <source src="video.ogg" type="video/ogg">
  Your browser does not support the video tag.
</video>// ww  w .ja va  2s. c o  m
<button onclick="myFunction()">Test</button>
<p id="demo"></p>

<script>
function myFunction() {
   var x = document.getElementById("myVideo").startDate;
   document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

The startDate property returns a Date object representing the current timeline offset of the video.

The startDate property can enable accurate synchronization of video streamed live over the internet.




PreviousNext

Related