Search code examples
javascriptgoogle-chromehtml5-audio

Setting HTML5 audio position


How to jump to certain time offsets in HTML5 Audio elements?

They say you can simply set their currentTime property (emphasis mine):

The currentTime attribute must, on getting, return the current playback position, expressed in seconds. On setting, if the media element has a current media controller, then it must throw an INVALID_STATE_ERR exception; otherwise, the user agent must seek to the new value (which might raise an exception).

Alas, it doesn't seem to work (I need it in Chrome).

There are similar questions, although, no answers.


Solution

  • Works on my chrome...

    $('#audio').bind('canplay', function() {
      this.currentTime = 29; // jumps to 29th secs
    });