html tutorial - onseeking Attribute in HTML - html5 - html code - html form



onseeking attribute in html

Learn html - html tutorial - onseeking attribute in html - html examples - html programs

  • The onseeking attribute specifies a script to run though the user starts moving to a new position in the audio/video.
  • The onseeking attribute is a section of the Event Attributes.

Syntax for onseeking attribute in HTML:

<element onseeking="myScript">

Differences between HTML 4.01 and HTML5 for onseeking attribute:

HTML 4.01

HTML 5

Applies To:

Elements Attribute
<audio> onseeking
<video> onseeking

Attribute Values:

Value Description
script The script to be run on onseeking

Sample Coding for onseeking Attribute in HTML:

Tryit<!DOCTYPE html>
<html>
 <head>
 <title>Wikitechy onseeking  attribute</title>
 </head>
 <body>
    <h1>Wikitechy HTML onseeking Attribute</h1>
    <video id = “wikiVideo” width="300" height="300" 
    controls onseeking ="onSeeking()">
    <source src="hibiscus.mp4" type="video/mp4">
    </video>
    <script>
    function onSeeking() 
    {
     document.getElementById("position").innerHTML = " Position has been moved to " 
     +document.getElementById("wikiVideo").currentTime;
    }
    </scripty>
    <p id="position">The video moves to a new position:</p>
</body>
</html>

Code Explanation for onseeking Attribute in HTML:

onseeking  Attribute Code Explanation

  1. <video> tag is used to display the video and it has id as “wikiVideo”.
  2. The onseeking attribute used to call onSeeking() JavaScript function, when user try to seeking the video.
  3. <source> tag defines the source of video resource.
  4. onSeeking() JavaSript function used to display the position of the video seeking by its time in <p> tag which has id as “position”.

Output for onseeking Attribute in HTML:

onseeking Attribute Tag Output

  1. The video file has been displayed.
onseeking Attribute Tag Output

  1. The output shows the playing video with its duration in seconds.
  2. The seconds of video is displayed as Position has been moved to 9.196897.

Browser Support for onseeking Attribute in HTML:

Yes 9.0 Yes Yes Yes

Tips and Notes

  • The currentTime property of the Audio/Video Object is used to get the present playback position

Related Searches to onseeking Attribute in html