Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Seek HTML Video with JQuery

Tags:

html

jquery

video

I'm trying to seek to a specific part of a video, and I'd like to use JQuery.

$('#video').currentTime gives me undefined. Is there something I'm missing?

(document.getElementById("video").currentTime works)

like image 314
K2xL Avatar asked Jun 28 '12 19:06

K2xL


1 Answers

It's important to understand that jQuery selector functions return a jQuery object. As such, you cannot access properties directly unless jQuery has a special function set up to handle them.

What you want to do is fetch the currentTime property so you can use prop()

$('#video').prop('currentTime');

Or, if you're feeling more vanilla:

$('#video')[0].currentTime;
like image 159
TheZ Avatar answered Oct 05 '22 07:10

TheZ