How to play a zipped wave file in Flash Mobile

Viewed 232

I am working on a project in Flash Mobile using ActionScript. I have a zipped wav file that I need to be able to de serialize and play as needed in a Button Press action. Below is the code for zipping the wav file.

                mic.removeEventListener(SampleDataEvent.SAMPLE_DATA, micSampleDataHandler);
                btnRecord.setStyle("icon", recOff);
                sampleCount++;

                // save the raw PCM samples as a bare WAV file
                var wav:ByteArray = new ByteArray();
                var writer:WAVWriter = new WAVWriter();
                writer.numOfChannels = 1;
                writer.sampleBitRate = 16;
                writer.samplingRate = 11025;
                samples.position = 0;
                writer.processSamples(wav, samples, 11025, 1);
                wav.position = 0;

                // zip the WAV file
                var fzip:FZip = new FZip();
                fzip.addFile(name + sampleCount.toString(), wav);
                var zip:ByteArray = new ByteArray();
                fzip.serialize(zip);
                var recSpot:Object = {
                        id: null,
                        audio: zip,
                        name: "New Audio File " + newRecNum,
                        existsdb: "false"
                };
                newRecNum++;
                recordings.addItem(recSpot);
            }

What can I do to play this file, really haven't had to play a zipped file before.

1 Answers
Related