Jump to content

[SOLVED] Video play speed scales with FPS


photo

Recommended Posts

Hello

 

I have some strange problem with the video playback. If the client has 60 FPS the video play time is right, if the client has 30 FPS video takes the double time, if the client has 90 FPS the video play time is the half.

 

I can fix this problem with following code in the update function:

float fps = engine.app.getFps();
engine.game.setIFps(rcp(fps));

But not with:

engine.game.setIFps(rcp(60)); or engine.game.setIFps(rcp(30));

I don't understand how these values play together. I thought setIFps sets getFTime to a fixed value. So in the sample setIFps is set to rcp(60), which should return a constant value and video playback should be right. 

If I set iFps to the current FPS the video plays right. What I do is nothing more then overwrite getFtime with a fixed value, if I don't do that, getFtime should return the right value. But this does not happen, the video playback scales with the current FPS and plays to fast or to slow. The same effect happens when using the tracker.

 

Thanks

Manuel

Link to comment
  • 3 weeks later...

Don't set the fixed ifps value on game. This parameter is required only for video grabbing purposes.

WidgetSpriteVideo will take that fixed ifps and will be updated with wrong time.

 

engine.ifps is equal to engine.app.getIFps();

ifps variable is controlled by engine.game.setIFps() function.

 

 

float Game::getIFps() const {
    if(enabled == 0) return 0.0f;
    if(ifps > EPSILON) return ifps * scale;
    return engine.ifps * scale;
}

 

engine.game.setIFps() function is dangerous.

Link to comment
×
×
  • Create New...