Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It seems that most browsers allow the second approach, although you would need to know the frame rate. Opera, however, is the exception, and requires an approach similar to your first one (the result is not perfect). Here's a <a href="http://jsfiddle.net/Z6FM2/2/" rel="noreferrer">demo page I came up with</a> that uses a 29.97 frames/s video (U.S. television standard). Note that it has not been extensively tested, so it might not work in IE 9, Firefox 4, or future versions of any browser.</p> <p>HTML:</p> <pre><code>&lt;p id="time"&gt;&lt;/p&gt; &lt;video id="v0" controls tabindex="0" autobuffer preload&gt; &lt;source type="video/webm; codecs=&amp;quot;vp8, vorbis&amp;quot;" src="http://www.html5rocks.com/tutorials/video/basics/Chrome_ImF.webm"&gt;&lt;/source&gt; &lt;source type="video/ogg; codecs=&amp;quot;theora, vorbis&amp;quot;" src="http://www.html5rocks.com/tutorials/video/basics/Chrome_ImF.ogv"&gt;&lt;/source&gt; &lt;source type="video/mp4; codecs=&amp;quot;avc1.42E01E, mp4a.40.2&amp;quot;" src="http://www.html5rocks.com/tutorials/video/basics/Chrome_ImF.mp4"&gt;&lt;/source&gt; &lt;p&gt;Sorry, your browser does not support the &amp;lt;video&amp;gt; element.&lt;/p&gt; &lt;/video&gt; </code></pre> <p>JavaScript (run on page load and uses jQuery 1.4.4 for the sake of brevity):</p> <pre><code>var vid = $('#v0')[0]; vid.onplay = vid.onclick = function() { vid.onplay = vid.onclick = null; setTimeout(function() { vid.pause(); setInterval(function() { if($.browser.opera) { var oldHandler = vid.onplay; vid.onplay = function() { vid.pause(); vid.onplay = oldHandler; }; vid.play(); } else { vid.currentTime += (1 / 29.97); } }, 2000); }, 12000); setInterval(function() { $('#time').html((vid.currentTime * 29.97).toPrecision(5)); }, 100); }; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload