ray-solomon
asked on
Flash can play mp3, but can it play wav?
I have 2 example pages using the same code but calling on different audio files.
One is an mp3 and the other is a waveform.
The mp3 works, but not the wav.
http://www.pocourl.com/mp3.php
http://www.pocourl.com/wav.php
How can I get the wav to work properly with flash without importing it into a swf container?
or if you can think of another cross-browser/platform way, then let me know.
Thanks.
Below is the actionscript I am using:
One is an mp3 and the other is a waveform.
The mp3 works, but not the wav.
http://www.pocourl.com/mp3.php
http://www.pocourl.com/wav.php
How can I get the wav to work properly with flash without importing it into a swf container?
or if you can think of another cross-browser/platform way, then let me know.
Thanks.
Below is the actionscript I am using:
// Action script...
// [Action in Frame 1]
var SoundLoader = {};
SoundLoader.loadSound = function (variableName, oldVal, newVal)
{
var _loc1 = this;
mySound = new Sound();
mySound.loadSound(newVal, true);
_loc1.createEmptyMovieClip("loader_mc", 5);
loader_mc.onEnterFrame = function ()
{
var _loc1 = this;
percentage = Math.round(mySound.getBytesLoaded() / mySound.getBytesTotal() * 100);
if (percentage >= 100)
{
_loc1._parent.mySound.start();
_loc1.onEnterFrame = null;
unloadMovie(_loc1);
} // end if
};
};
_root.watch("playSound", SoundLoader.loadSound);
any specific reason you want it wav? you can convert it to mp3, or is it very dynamic?
attach the wav file, if so.
attach the wav file, if so.
ASKER
All wav files I am using are in pcm format.
This is required for a third-party api in which I am already using successfully.
All wav audio files meet these criteria for the api:
Sample size: 16 bit
Sample rate: 8 kHz
Channels: mono
Format: PCM
Bit Rate: 128kbps (normally this, but not required)
I wrote a script to check the required criteria of the audio file upon upload.
Now, I am trying to integrate a simple audio preview so clients can quickly hear it.
I used the same code as I used for mp3 from my other web site, but it did not work for wav files.
Is there different action script code I should be using?
This is required for a third-party api in which I am already using successfully.
All wav audio files meet these criteria for the api:
Sample size: 16 bit
Sample rate: 8 kHz
Channels: mono
Format: PCM
Bit Rate: 128kbps (normally this, but not required)
I wrote a script to check the required criteria of the audio file upon upload.
Now, I am trying to integrate a simple audio preview so clients can quickly hear it.
I used the same code as I used for mp3 from my other web site, but it did not work for wav files.
Is there different action script code I should be using?
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
I ended up using html embed code for windows media player.
It was the only option I had.
It was the only option I had.
flash player only supports PCM WAV file format. - one way to test if your wav is in the right format, import it into a swf file and if you get an "unrecognised file format" error - then your wav file is the problem.