Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by Zheref

Hello,

I'm trying to play some background music with ImpactJS but it's only working in Internet Explorer. It doesn't work with Chrome and Firefox. I don't know what I'm doing bad. I thank any help. Next is the snippet I'm using to fo that:

InstartiusSplash = ig.Game.extend
(
{
image: new ig.Image('media/image.jpg'),

init: function()
{
ig.music.add('intro.*');
ig.music.volume = 1;
ig.music.play();
... the rest

I've already tried many things. But nothing works. I have both ogg and mp3 files in the folder. Besides my Chrome and Firefox plays perfectly html audio with the new html5 audio tags and by opening my ogg and mp3 files directly with the browser.

1 decade ago by Graphikos

Is &039;intro.*' a valid path to the file? Seems like it should be something more like #ig.music.add('media/music/intro.*');. If not then that's a silly place to put your sound file.

Really it could be a preload issue also. As suggested in Working with Assets you should make sure the music is added to the preloader.

InstartiusSplash = ig.Game.extend({

image: new ig.Image('media/image.jpg'),
introMusic: new ig.Sound('media/intro.*'),

init: function() {
	ig.music.add(this.introMusic);
	ig.music.volume = 1;
	ig.music.play();
}
...

1 decade ago by Zheref

I've already tried many paths. Both in inner folders and in the site root.
I've just done what you're suggesting me. However, it's not working yet :(

1 decade ago by Graphikos

Doesn't matter where you put it as long as the path is valid. If it's still not working you'll need to post some more code or something so we all have a better idea.
Page 1 of 1
« first « previous next › last »