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. Gone element blocking the view

Hi all,

I have a fairly easy layout : Two relative layouts filling the parent
frame layout.

firstRelativeLayout appears first in the xml and secondRelativeLayout
appears next.

firstRelativeLayout  has it's visibility not set in the xml (visible
by default).
secondRelativeLayout has it's visibility set to gone.

firstRelativeLayout respond to touch perfectly.

Then I programmatically set secondRelativeLayout visibility to visible
and back to gone.

firstRelativeLayout does not respond to touch anymore.

Any idea what can go wrong ?

Yahel

-- 

2. Possible to check .apk signature?

 Until now, I haven't really concerned myself with app piracy; I only 
have one app under my belt for Android, it's in beta and it's free. I'm 
about to start development on another app and looking to use ProGuard 
for obfuscation and LVL as I would like to make it a paid app, and I've 
been wondering something ever since the news that LVL had been 
circumvented months ago. Is it possible to check the .apk's signature 
from within the API? If not currently, perhaps Google might add some 
code to Android itself or to the API to enable LVL to make sure that the 
.apk signature matches the signature that Android Market already has on 
file?


Just a thought, not even necessarily a feasible one.
Raymond

--

3. What is the URL for an app on android market?

4. bugreport tutorial

5. Wierd memory leak

6. GLSurface doesn't draw anything when i came back again.

7. reliable app store?