MediaPlayer blocked(AudioFlinger write blocked) while playing animation

by quill » Fri, 20 May 2011 15:19:15 GMT


Sponsored Links
 Hi all,

I have a thread to play audio and animation together. It's a frame
animation. The drawable resources are in sdcard. When I play the
animation, I use a handler to send message to refresh images one by
one.
Here's my code:
final Handler handle = new Handler(){
     public void handleMessage(Message msg){
          super.handleMessage(msg);
          BitmapDrawable bmpDraw = new BitmapDrawable("sdcard/
anim/"+msg.obj);
          imageView.setBackgroundDrawable(bmpDraw);
          imageView.invalidate();
          if(msg.what < fileNames.length-1){
              sendMessageDelayed(obtainMessage((msg.what+1),
fileNames[msg.what+1]),50);
         }
     }
};
handler.sendMessage(handler.obtainMessage(0,fileNames[0]);
MediaPlayer mp = new MediaPlayer();
...//play audio

The animation performs fine, but the audio will be stopped when it
begins to play for seconds. From logcat I see AudioFlinger: write
blocked for 89 msec...

I don't use AnimationDrawable because there are many images in sdcard,
when I use addFrame(AnimationDrawable.createFromPath(...)) I got an
OutOfMemory Exception.

Am I doing the right thing? Can anyone help me?

-- 



Other Threads

1. Khalid Shaikh is back "developing" Android applications under the name "Sapphire Apps"

I have really had enough of wading through the {*filter*}$5 applications
that this guy is putting out.  If you don't know who he is, Google his
name and you'll see multiple articles on what he's done...

Google, can you please realize that this guy is *still* spamming the
Market with his terrible $5 apps, and making it more difficult for the
other devs to push their apps?

At some point he was pulled from the Market - I don't know the
circumstances, but there was a time where we didn't see any of his
apps.  I would like to return to that time.

I know he was banned from Apple's store (he put out something like 900
apps - all approved somehow, and of the same terrible quality).  Can't
we get this done here?   I am confident that I speak for more than a
few devs here.

-Rob
--~--~---------~--~----~------------~-------~--~----~

2. "Discard" button in Compose screen of Google Mail

2009/9/17 lbcoder <lbco...@gmail.com>:

Heehee, now we truly know you are an android for sure lbcoder :)






--~--~---------~--~----~------------~-------~--~----~

3. In Android 1.5, are Video and Audio attachment in MMS supported when creating a new MMS message?

4. Engaging a Developer for Paid-For App development - Where to Look/Post?

5. ALARM program or app

6. name given to "phone call" process ??

7. Speech recognition on Emulator