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 include 3rd party jar in APK with make in android repo?

Hello,

 I am working on the Android builtin Contact app. It can be build with "make
Contact" in the repo. Now, I want to use a 3rd party jar, and how to package
the jar into Contact.apk?

 It is easy to include external jar for Eclipse Android project, but not for
android git repo codes. I am afraid package/apps/Contact/Android.mk should
be changed to include external jar, how to do it?

-- leo

-- 

2. Camangi web station butut:-)

Setelah smartphone, android diharapkan running di tablet, layar besar, cepat, 
loading mudah.
Saya berpikir untuk punya sebuah tablet android, untuk baca majalah, comic,  
nonton dan web browser.
Salah satu produk release awal adalah camangi, but review dr gizmodo , mending 
dibuang katanya :-)

http://m.gizmodo.com/site?t=Y3eXoCngToJQgYNqPitzgQ&sid=gizmodo
Salam,

Lucky Sebastian
@K-9 android

-- 
=========================
Google Groups "Indonesian Android Community [id-android]" group.

To post to this group, send email to id-android@googlegroups.com

To request to subscribe to this group:

Click  

3. How to refresh view after chaging Visible?

4. FAT32 FS Code

5. MapView Overlays Containing Widgets/View

6. How can i stop a thread in a Activity?

7. Eclipse/Android/Mac OS x problem with HelloAndroid