ofVideoPlayer::nextFrame not implemented in Android


#1

hello,
for a project I need to have a video in a paused state, which i can control by pressing a button to move frame by frame. I tried using ofVideoPlayer::nextFrame() but it seems that even existing, this function is not implemented. The same seems to be the case with ofVideoPlayer::getCurrentFrame().
Has anyone ideas how these issues could be solved? Thanks for your help!


#2

Hi @lmasd,

The Android MediaPlayer which is used under the hood in the actual videoplayer class doesn’t provide a means to extract the FPS from a video file. This FPS is needed to generate meaningful implementations for the methods you want. When you scroll through the code on OF’s Github, you can see the same.

What the Mediaplayer does provide, are means to get the total duration of the file (in milliseconds) and means to seek to a certain position. So if you know the framerate of your videofile beforehand and if it does stay stable over the whole videofile (mp4 allow dynamic fps), your best bet is to work out the amount of milliseconds you should advance in order to display the next frame and use the setPosition() functions with either the normalized percent [0.,1.] or millisecond value to display it.


#3

Hey, thank you very much! I was hoping that it would be as easy to jump from frame to frame as in OSX, but of course there is quicktime under the hood, which provides such functionality.
Than I’ll try to implement it following your advice, thanks again!
Cheers!