Aidan Gee
Aidan Gee

Reputation: 579

return frame number video js?

Does anyone know how I can return what frame the video would be on at a certain point ?

so for example the video is playing and I press a js button ive made and it returns the current frame the video is on and prints it on screen .

Upvotes: 1

Views: 2300

Answers (1)

heff
heff

Reputation: 3249

There's no way to know the exact frame of the video from the html5 video element, but if you know the frame rate (e.g. 30 fps) up front you could do the calculation.

var frame = Math.floor(myPlayer.currentTime() * frameRate);

Upvotes: 2

Related Questions