![]() |
Definition and Usage
The Tip: Use the currentTime property of the Audio/Video Object to get the current playback position. Applies to
The
Browser Support
The
|
Example:
HTML
<!DOCTYPE html>
<html>
<body>
<p id="demo">Move to a new position in the audio:</p>
<audio id="myAudio" controls onseeked="myFunction()"> <source src="https://file-examples.com/wp-content/storage/2017/11/file_example_MP3_5MG.mp3" type="audio/ogg"> <source src="https://file-examples.com/wp-content/storage/2017/11/file_example_MP3_5MG.mp3" type="audio/mpeg"> Your browser does not support the audio element.
</audio>
<script>
function myFunction() { document.getElementById("demo").innerHTML = "You moved to position " + document.getElementById("myAudio").currentTime;
}
</script>
<p>This example demonstrates how to use the "onseeked" attribute on an AUDIO element.</p>
</body>
</html>
Example:
HTML
<!DOCTYPE html>
<html>
<body>
<p id="demo">Move to a new position in the video:</p>
<video id="myVideo" width="320" height="176" controls onseeked="myFunction()"> <source src="https://www.sample-videos.com/video321/mp4/240/big_buck_bunny_240p_30mb.mp4" type="video/mp4"> <source src="https://www.sample-videos.com/video321/mp4/240/big_buck_bunny_240p_30mb.mp4" type="video/ogg"> Your browser does not support HTML5 video.
</video>
<script>
function myFunction() { document.getElementById("demo").innerHTML = "You moved to position " + document.getElementById("myVideo").currentTime;
}
</script>
<p>This example demonstrates how to use the "onseeked" attribute on a VIDEO element.</p>
<p>Video courtesy of <a href="https://www.bigbuckbunny.org/" target="_blank">Big Buck Bunny</a>.</p>
</body>
</html>
html onseeked attribute |
How to Run "myFunction" when the audio changes the position - HTML onseeked Attribute | HTML Attribute |
How to Run "myFunction" when the video changes the position - HTML onseeked Attribute | HTML Attribute |
Type
: |
Develop |
Category
: |
Web Tutorial |
Sub Category
: |
HTML Attribute |
Uploaded by
: |
Admin |
Read Article https://horje.com/learn/1434/reference