AudioPlay Give error
<p>I am using below code to play audio file. </p>

<p>But it gives me error.</p>

<pre><code>01-05 11:35:05.793: W/System.err(1739): java.lang.IllegalStateException
01-05 11:35:05.793: W/System.err(1739):     at android.media.MediaPlayer.prepare(Native Method)
01-05 11:35:05.793: W/System.err(1739):     at com.android.halfivrs.MyAudioControl.startAudio(MyAudioControl.java:22)
01-05 11:35:05.793: W/System.err(1739):     at com.android.halfivrs.HalfIVRSActivity.onCreate(HalfIVRSActivity.java:13)
01-05 11:35:05.793: W/System.err(1739):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
01-05 11:35:05.793: W/System.err(1739):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
01-05 11:35:05.793: W/System.err(1739):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
01-05 11:35:05.793: W/System.err(1739):     at android.app.ActivityThread.access$2200(ActivityThread.java:119)
01-05 11:35:05.793: W/System.err(1739):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
01-05 11:35:05.793: W/System.err(1739):     at android.os.Handler.dispatchMessage(Handler.java:99)
01-05 11:35:05.793: W/System.err(1739):     at android.os.Looper.loop(Looper.java:123)
01-05 11:35:05.793: W/System.err(1739):     at android.app.ActivityThread.main(ActivityThread.java:4363)
01-05 11:35:05.793: W/System.err(1739):     at java.lang.reflect.Method.invokeNative(Native Method)
01-05 11:35:05.793: W/System.err(1739):     at java.lang.reflect.Method.invoke(Method.java:521)
01-05 11:35:05.793: W/System.err(1739):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
01-05 11:35:05.793: W/System.err(1739):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
01-05 11:35:05.793: W/System.err(1739):     at dalvik.system.NativeStart.main(Native Method)
</code></pre>

<p>Here is my Code.</p>

<pre><code>public class MyAudioControl {

    private Context mContext;

    public MyAudioControl(Context con) {
        this.mContext = con;
    }

    private MediaPlayer player;

    public void startAudio() {
        try {
            player = MediaPlayer.create(mContext, R.raw.tabla);
            player.setLooping(false); // Set looping
            player.prepare();
            player.start();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void stopAudio() {
        try {
            player.stop();
            player.reset();
            player.release();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
</code></pre>

<p>Does any one has idea what's wrong with above code?</p>

<p>Thank You.</p>
