Jump to content

[SOLVED] Rewinding video does not work as expected


photo

Recommended Posts

I start a thread called "mainloop", as below. I expect it to rewind the video after 5 seconds. Instead the video skips back to the start for a single frame then carries on. 

void mainloop() {

  Gui gui;
  WidgetSpriteVideo bgvid;
  AmbientSource bgvidsound;

  gui = engine.getGui();

  bgvid = new WidgetSpriteVideo(gui,"data/mupK/mov1.ogv", 0);
  bgvidsound = new AmbientSource("data/mupK/mov1.ogv", 0);
  bgvid.setAmbientSource(bgvidsound);

  gui.addChild(bgvid, GUI_ALIGN_BACKGROUND);

  while(1) {

    bgvid.stop();
    bgvidsound.stop();

    bgvid.setVideoTime(1.0f);
    bgvidsound.setTime(1.0f);

    bgvidsound.play();
    bgvid.play();

    sleep(5.0f);
  }


}

Link to comment

Hi,

 

This happens because audio.setTime() is not setting audio time immediatly to the given value (it waits for next update to perform this action). And since video is in sync with audio track you can get such issue (video is resetting, but audio track is still playing).

 

Please, add engine.sound.renderWorld(1) after bgvidsound.setTime(1.0f). This command performs force update of sound system, so audio.setTime() will be called immideatly and video playback will be reset correctly.

 

Thanks!

  • Like 1

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
×
×
  • Create New...