Jump to content

Video player freeze when try to sync audio


photo

Recommended Posts

hello , when i try to play video with sound my video is just showing first frame.

No audio at all also...

 

my code is here as shown below :

#include <core/unigine.h>
#include <core/scripts/system.h>
#include <core/scripts/stereo.h>
#include <core/scripts/wall.h>
PlayerSpectator player;
WidgetSpriteVideo video;
AmbientSource source;
int init() {

player = new PlayerSpectator();
player.setPosition(vec3(1.703f,0.702f,10.493f));
player.setDirection(vec3(0.655f,0.749f,-0.101f));
player.setMinVelocity(15.0f);
player.setMaxVelocity(30.0f);

source = new AmbientSource("rocky.oga");

engine.game.setPlayer(player);

Gui gui = engine.getGui();

video = new WidgetSpriteVideo(gui,"rocky.ogv",0);
video.setWidth(320);
video.setHeight(240);
video.setPosition(800,10);
video.setAmbientSource( source );
gui.addChild(video,GUI_ALIGN_OVERLAP);

video.setLoop(1);
//source.play();
video.play();
return 1;
}
int shutdown() {
return 1;
}
int update() {
return 1;
}

 

 

whats wrong here?

Link to comment

It is the sound that should be looped. That is, the sound controls the playback and video is synchronized with it:

 

//video.setLoop(1);  // it's the other way around!
source.setLoop(1);
// both the video and the sound should be played
source.play();
video.play();

Link to comment
×
×
  • Create New...