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
Here's my code:
final Handler handle = new Handler(){
     public void handleMessage(Message msg){
          BitmapDrawable bmpDraw = new BitmapDrawable("sdcard/
          if(msg.what < fileNames.length-1){
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. Stepping thru android base code

Hi All,

I've the 1.5 sdk pkg, as well as I've the android src ( including the
kernel). I can build the android src, but I'm trying to step thru some
of the internal code ( i.e android.os.*   or some such ). Under
eclipse de{*filter*}, it says code not found, and sometime asking for
giving path to source ...

I know that the eclipse is working with android1.5 so it is trying to
look at the sdk location, and that does not seem to have all the
android framework related code!!!.

Question is if I give the path to the android src ( that I've and
bult), would the de{*filter*} pick it from there, if so then is there a
root folder I can point to and the de{*filter*} would recursively search
and bring the code for stepping thru. Or do I need to build a package
and then point to that package when I build the app...


2. android-developers - 26 new messages in 16 topics - digest

Who use a Titanium Developer for buld android apps ?


3. Is it possible to use the accelerometer in a background service?

4. IllegalArgumentException occur: parameter must be a descendant of this view in

5. How to use drawable resource in custom XML?

6. font android

7. Animation of a View