Jump to content

[SOLVED] Video playback problem


photo

Recommended Posts

Hello!

I have a problem. If I modify "C:\Unigine Evaluation Kit\demos\samples_widgets_d3d11.bat": to "world_load samples/widgets/splash_03" instead "world_load samples/widgets/button_00". And add into "C:\Unigine Evaluation Kit\data\samples\widgets\splash_03.cpp" in

 

Splash() {

...

button_clicked();

}

 

Video is played very fast. However if I click in splash_03 button from Unigine UI, video played with normal speed.

 

Questions: how play video with normal speed if I starting from bat.file?

Link to comment
  • 3 weeks later...
  • 2 weeks later...

There's a trick in that. Both script init() and splashes stop the fps counter (for example, so you get the valid FPS value after the world load). They call engine.app.stopFPS() which increments a flag under the hood.

 

But in this sample engine.app.startFps() is called only once. The flag value is decremented, but it's not enough, since init() has also incremented this value. As a result, splash is played with default 60 fps.

 

Calling engine.app.startFps() function twice is all you need to solve this issue. (But be careful, if you click a button to play the splash screen in the update, it'll result in assertion).

 

engine.app.startFps();
engine.app.startFps();

do {
engine.splash.renderInterface();
} while(sprite_video.isPlaying() && engine.app.clearKeyState(APP_KEY_ESC) == 0);

engine.app.stopFps();
engine.app.stopFps();

Link to comment
×
×
  • Create New...