jsMovie icon indicating copy to clipboard operation
jsMovie copied to clipboard

Skip frames if jsMovie is unable to keep up with the desired framerate

Open hansoninc opened this issue 12 years ago • 3 comments

We're using jsMovie to create several sequences on a page that will run on desktop PCs and tablets (specifically we're testing on the iPad). On the iPad 1 and iPad 2 we've noticed that the movie plays choppily because the device is unable to play frames at the requested interval.

I hooked into the code in the play_movie_event method where you're calculating the "real FPS". If the realFPS is less than 75% of the desired FPS, I added a bit of code to calculate the actual play rate and skip frames if necessary (by calling gotoFrame() multiple times until the actualPlayRate is >= 1).

I tested this locally with IE9 and Chrome, hopefully it's something you can use.

hansoninc avatar Jun 24 '13 17:06 hansoninc

looks like a good idea, but there should at least be an option to disable this behavoir since some large image png animation might run really slow on older mobile devices. some developer might rather have a slower animation then a loss of frames.

i'll think of another code solution or maybe you can update your pullrequest

konsultaner avatar Aug 08 '13 14:08 konsultaner

Richi,

Good suggestion. I made skipFrames an optional property defaulting to false. I tested it with a 1200x1200 transparent PNG framestack and it seems to be working as expected with skipFrames set to true and false.

hansoninc avatar Aug 20 '13 16:08 hansoninc

I know it's been 7 Months... But this is just a hobby project and I had 0 time. Today I started working on jsMovie again and found out that your code might speed up the movie.

If the first loss of frames is exactly 0.75 lets say at 12fps you will skip at 9fps and may end up at 18fps at this moment, when skipping every second frame.

2 Problems: The realFps is not bound to each frame and the realFps don't get recalculated.

I'll try to add an average fps, including frame skipping to keep up with the set fps.

konsultaner avatar Mar 16 '14 21:03 konsultaner