Reputation: 75983
Rats!
I'm doing a by-the-book sound playback in Flex and I can't hear it.
I tried this:
var snd : Sound = new Sound();
snd.addEventListener(Event.COMPLETE, function(e : Event) : void
{
snd.play();
});
snd.addEventListener(IOErrorEvent.IO_ERROR, function(e : IOErrorEvent) : void
{
Log.format("Playing gong sound failed...\n{0}", e.toString());
});
snd.load(new URLRequest("http://localhost:8000/gong.wav"));
And I tried the simpler:
var snd : Sound = new Sound(new URLRequest("http://localhost:8000/gong.wav"));
snd.play();
But I hear nothing. Launching the same mp3 file in vlc plays it fine. So yes, my speakers are turned on. :)
It's not the loading. I can see it's actually loading those 40k bytes fine, and if I give the wrong URL I do get an IOError. It's as if it's playing but nothing can be heard.
Upvotes: 1
Views: 572
Reputation: 22604
From "Working with Sound" in the flex documentation:
Although there are various sound file formats used to encode digital audio, ActionScript 3.0, Flash Player and AIR support sound files that are stored in the mp3 format. They cannot directly load or play sound files in other formats like WAV or AIFF.
Sure you're playing an mp3? Your URL says ".wav"...
Upvotes: 2