Jump to content

[SOLVED] AmbientSource not working


photo

Recommended Posts

Posted

Hi

 

The sounds is not playing, why ?

 

What wrong with the following code?

 

 

init() {

 

setUpScreen();

 

}

 

 

 

void setUpScreen() {

 gameRunVideoBground = new WidgetSpriteVideo(gui,
        engine.getDataPath() + "videos/gamebackground/" + gamebackgroundVids[videoNumberGameBg]);
gameRunVideoBground.addLayer();

gameRunVideoBground.setOrder(1);
gui.addChild(gameRunVideoBground,GUI_ALIGN_EXPAND);
gameRunSoundBground = new AmbientSource(engine.getDataPath() + "videos/gamebackground/" +  gamebackgroundVids[videoNumberGameBg]);

gameRunVideoBground.setAmbientSource(gameRunSoundBground);

 

}

 

 

then in update

 

 

update() {

 

 

if(gameRunVideoBground != NULL && gameRunVideoBground.isPlaying() == 0 && state == 3 && state3Played == 1) {

            gameRunVideoBground.setVideoTime(0.01f);
            gameRunSoundBground.setLoop(1);
            gameRunSoundBground.play();
            gameRunVideoBground.play();         
                        
    }

 

 

Posted

Hi Paul,

 

 

Sorry, can't reproduce. Please, check the <SDK>/data/samples/widgets/video_01 sample. Video and audio should play correctly here.

 

Also, in attached zip archive you can find simple test scene with playing video and audio. You will need to put the files in <SDK>/data directory and modify path to the video file inside script. I've tested it on your mov1.ogv file and it worked just fine.

 

 

Thanks!

 

audio_test.zip

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

Posted

Hi Paul,

 

Sorry, my bad :) You need to have a player in the world to hear sound sources. So, you need to add in init():

PlayerDummy player = new PlayerDummy();
engine.game.setPlayer(player);

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

×
×
  • Create New...