Mediaplayer + Audioflinger problem

All your problems with Audio, Video and Images.

Mediaplayer + Audioflinger problem

Postby Grendizer » Sat Mar 05, 2011 3:15 pm

Hi all

I have a dialpad that contains imagebuttons, and when ever a button is clicked a sound is played.
So if number one is pressed a file will be played saying "One". For this purpose i'm using mediaplayer.
The thing is if I press a button multiple times, I'll get an error saying the following:
AudiotTrack: AudioFlinger could not create track, status: -12
AudioSink: Unable to create audio track
Mediaplayer: error(-19, 0)
Mediaplayer: Error(-19, 0).

For each onclick event i send the mediaplayer and the file to a's an example:

Button nr. 1
Code: Select all
ImageButton one = (ImageButton) findViewById(;
      one.setOnClickListener(new OnClickListener() {
         public void onClick(View v) {
            playSound(mp, R.raw.mamacita_one);            

Method for playing sound:
Code: Select all
private void playSound(MediaPlayer mp, int tone) {
      if(mp != null) {
         mp = null;
      mp = MediaPlayer.create(this.getApplicationContext(), tone);

I'd appreciate any help here...
Junior Developer
Junior Developer
Posts: 10
Joined: Sun Mar 14, 2010 5:14 pm


Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 5 guests