mediaplayer dies android
<p>i have a little problem with the media player class. I have a button, and by pressing it a sound will be played. The thing is that there is some delay between when i press the button and when the sound is played, and if i press it too many times the media player dies, and then no sound is played at all and i get the following errors: </p>

<pre><code>ERROR/MediaPlayer(3960): error (-19, 0)
ERROR/AudioTrack(3931): AudioFlinger could not create track, status: -12
ERROR/AudioSink(3931): Unable to create audio track
</code></pre>

<p>Here's the code:</p>

<pre><code>Button b = (Button)findViewById(R.id.button);
        b.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                AssetFileDescriptor afd;
                try {

                    afd = getAssets().openFd("bassdrum6.mp3");
                    player = new MediaPlayer();
                    player.setDataSource(afd.getFileDescriptor(),afd.getStartOffset(),afd.getLength());
                    player.prepare();
                    player.start();

                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        });
</code></pre>

<p>I don't know what's wrong here. I need some help.</p>

<p>Thanks in advance.</p>
