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. How to draw a circle of Given Radius on Google Maps

Hi,

Google Maps provide a GPolygon class which returns the crilce of a
given radius; by using addOverlay method of GMap2 this circle can be
draw on Map.

In android we only have MapView class. How can I access addOverlay and
use GPolygon class in Anroid.

I want to implement the same functionarly provided by
http://googlemapsapi.blogspot.com/2007/01/gpolygon-example.html
but in Android.

Regards,
Shani

-- 

2. Blur an image

Hi,
I have a camera application that captures an image and saves it in the
sdcard.I want to blur the image now.I need to design a simple blur
filter,I have no idea how I can do it in android.I can not find any
examples anywhere.Can someone tell me the basic steps to blur an image
in android?
--~--~---------~--~----~------------~-------~--~----~

3. How to retrieve undelivered messages from handler when process is being killed

4. Having Problem in Getting Webservice Soap Object response casting to userdefined typ

5. Access Context from a different Package

6. Rotate an image in android

7. Access Context from a different Package : getApplication returns null