Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7750883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:24:20+00:00 2026-06-01T11:24:20+00:00

i have build a small test app in Flash Pro 5.5 overlayed with the

  • 0

i have build a small test app in Flash Pro 5.5 overlayed with the AIR 3 sdk.
is has just 2 buttons to record and playback audio from the microphone.

when i test this on my iPhone 3g – i record myself saying “1-2-3-4-5”. but when i playback a half a second or so is missing from the beginning : “3-4-5-“.

when i test this on the desktop all is fine

is this a result of the iPhone 3g’s cpu power or is it a bug or is it my code?

thanks
Saar

if anyone could try this code and see if he/she reproduces this, i would appreciate it

this is the app:

all i have on stage is 2 rectangled movie clips named “recorded” and “player”
all the code is in this document class:

package  {

          import flash.display.MovieClip;
          import flash.media.Microphone;
          import flash.media.SoundMixer;
          import flash.events.MouseEvent;
          import flash.utils.ByteArray;
          import flash.media.Sound;
          import flash.media.SoundChannel;
          import flash.events.SampleDataEvent;
          import flash.media.AudioPlaybackMode;


          public class RecTest extends MovieClip {
                    var mic:Microphone;
                    var nowRecording:Boolean = false;
                    var nowPlaying:Boolean = false;
                    var recordedBytes:ByteArray = new ByteArray();
                    var s:Sound = new Sound();
                    var sc:SoundChannel;

                    public function RecTest() {
                              mic = Microphone.getMicrophone(-1);
                              SoundMixer.useSpeakerphoneForVoice = true;
                              SoundMixer.audioPlaybackMode = AudioPlaybackMode.MEDIA;
                              mic.gain = 100;
                              mic.setSilenceLevel(0);
                              mic.rate = 44;

                              recorder.addEventListener(MouseEvent.CLICK, onRec);
                              player.addEventListener(MouseEvent.CLICK, onPlay);
                    }

                    function onRec(e:MouseEvent) {
                              if (nowRecording) {
                                        trace("stopped");
                                        mic.removeEventListener(SampleDataEvent.SAMPLE_DATA, getMicAudio);
                                        nowRecording = false;
                              } else {
                                        trace("recording");
                                        recordedBytes.position = 0;
                                        recordedBytes.length = 0;
                                        mic.addEventListener(SampleDataEvent.SAMPLE_DATA, getMicAudio);
                                        nowRecording = true;
                              }
                    }

                    function onPlay(e:MouseEvent) {
                              if (nowPlaying) {
                                        trace("stopped");
                                        sc.stop();
                                        s.removeEventListener(SampleDataEvent.SAMPLE_DATA, playAudio);
                                        nowPlaying = false;
                              } else {
                                        trace("playing");
                                        recordedBytes.position = 0;
                                        s.addEventListener(SampleDataEvent.SAMPLE_DATA, playAudio);
                                        sc = s.play();
                                                sc.addEventListener(Event.SOUND_COMPLETE, onComplete,false,0,true);
                                        nowPlaying = true;
                              }
                    }

                        function onComplete(e:Event) {
                                              trace("stopped");
                                              s.removeEventListener(SampleDataEvent.SAMPLE_DATA, playAudio);
                                              nowPlaying = false;
                    }


                    function getMicAudio(e:SampleDataEvent) {
                              recordedBytes.writeBytes(e.data);
                    }

                    function playAudio(e:SampleDataEvent) {
                              for (var i:int = 0; i < 8092 && recordedBytes.bytesAvailable > 0; i++) {
                                        e.data.writeBytes(recordedBytes);
                                        e.data.writeBytes(recordedBytes);
                              }
                    }
          }

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T11:24:22+00:00Added an answer on June 1, 2026 at 11:24 am

    ok, this seems to be a lag in the iOS recording. so i use a workaround: constant recording to a buffer and using the buttons to record the in and out positions of the ByteArray for playback

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to build small (for now) admin app in Silverlight2, and would like
I'm trying to build a small testing app with erlang+mnesia. I have a user
I have just started having a go at developing a small KDE app as
I have a small problem with UINavigationController animation between two view. My application build
I am a broke college student. I have built a small web app in
I need to build a small web app that will ultimately need to be
I am a single developer and I have a small app that I sell.
I have a small app I've made that I intend to make available on
Well, my problem is what the title says. I have build a small application
I have a small Qt4 project which I want to build with cmake. It

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.