I embedded an mp3 file be used as background music for my app. Though it works fine, the problem is that it doesn’t play the whole track, it just plays the first 32 seconds of it (the mp3 file is 1:30 min).
Does anyone here has any idea why?
I’ve read here that maybe the sound doesn’t fit into the supported flash player sound format, but I don’t think that’s the problem! The file is not that big, but maybe I am wrong?
Any idea whats causing the problem? Or how to fix it? The code is fine, am sure of it (its pretty simple. Just embedded the mp3, initialized the required variable and played the sound. Nothing fancy)
EDIT: the mp3 is encoded at 44100 KHz
EDIT Here is the code, just incase
package
{
import flash.display.Sprite;
import flash.media.Sound;
import flash.media.SoundChannel;
public class BackgroundMusic extends Sprite
{
[Embed(source="swfs/bg.mp3")]
private var BG:Class;
public function BackgroundMusic()
{
var backgroundMusic:Sound = new BG();
backgroundMusic.play();
}
}
}
As the aforementioned link suggests, the problem was indeed with the mp3 file itself. Basically it was too big. So after reducing it from 44kHz stereo 32 bit to 44kHz stereo 16 bit it worked fine, and now it runs all the way through. With that said its kinda weird that we can’t embed higher quality mp3 files. I presume that this problem wouldn’t be an issue with loading (rather than embedding) but I haven’t tested it. If anyone here has an idea on how to fix this problem without reducing the quality of the mp3 please share