java.io.IOException:prepared failed:status=0x1
<p>Please help me out to resolve this error, I am trying this from past 5 days and unable to resolve it.</p>

<p>As "Text to speach" in android does not have pause state, I am trying to do with mediaplayer to pause and play.</p>

<p>converting string of text to .3gp format and storing in sdcard,till here its working fine, but I am facing problem in mediaPlayer, it is throwing below error</p>

<pre><code>07-10 09:12:12.279: D/(13589): temper destination file/mnt/sdcard/tmpaudio.3gp
07-10 09:12:12.279: I/TextToSpeech.java - synthesizeToFile(13589): synthesizeToFile text of length 256
07-10 09:12:12.479: D/MediaPlayer(13589): setDataSource(tmpaudio.3gp)
07-10 09:12:12.489: E/MediaPlayer(13589): error (1, -2147483648)
07-10 09:12:12.489: W/System.err(13589): java.io.IOException: Prepare failed.: status=0x1
07-10 09:12:12.489: W/System.err(13589):    at android.media.MediaPlayer.prepare(Native Method)
07-10 09:12:12.489: W/System.err(13589):    at net.sf.andpdf.pdfviewer.PdfViewerActivity$GraphView$2.onClick(PdfViewerActivity.java:651)
07-10 09:12:12.489: W/System.err(13589):    at android.view.View.performClick(View.java:2485)
07-10 09:12:12.489: W/System.err(13589):    at android.view.View$PerformClick.run(View.java:9080)
07-10 09:12:12.489: W/System.err(13589):    at android.os.Handler.handleCallback(Handler.java:587)
07-10 09:12:12.489: W/System.err(13589):    at android.os.Handler.dispatchMessage(Handler.java:92)
07-10 09:12:12.489: W/System.err(13589):    at android.os.Looper.loop(Looper.java:130)
07-10 09:12:12.489: W/System.err(13589):    at android.app.ActivityThread.main(ActivityThread.java:3683)
07-10 09:12:12.489: W/System.err(13589):    at java.lang.reflect.Method.invokeNative(Native Method)
07-10 09:12:12.489: W/System.err(13589):    at java.lang.reflect.Method.invoke(Method.java:507)
07-10 09:12:12.489: W/System.err(13589):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:875)
07-10 09:12:12.489: W/System.err(13589):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:633)
07-10 09:12:12.489: W/System.err(13589):    at dalvik.system.NativeStart.main(Native Method)
07-10 09:12:12.489: D/MediaPlayer(13589): start state 0
07-10 09:12:12.489: E/MediaPlayer(13589): start called in state 0
07-10 09:12:12.489: E/MediaPlayer(13589): error (-38, 0)
07-10 09:12:12.529: E/MediaPlayer(13589): Error (-38, 0)
</code></pre>

<p>Code:</p>

<pre><code>public void onClick(View v) {                   
    mediaPlayer = new MediaPlayer();
    if (mBtplay.getText().equals(getString(R.string.play_str))) {
        PdfReader reader = null;
        try {
            reader = new PdfReader(pdffilename);
        } catch (IOException e3) {
            // TODO Auto-generated catch block
            e3.printStackTrace();
        }
        int num = mPdfPage.getPageNumber();
        String str = null;
        try {
            str = PdfTextExtractor.getTextFromPage(
                                                   reader, num);
        } catch (IOException e2) {
            // TODO Auto-generated catch block
            e2.printStackTrace();
        }

        HashMap&lt;String, String&gt; myHashRender = new HashMap&lt;String, String&gt;();
        myHashRender.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, str);

        File appTmpPath = Environment.getExternalStorageDirectory();
        System.out.println(""
                           + appTmpPath.getAbsolutePath());
        appTmpPath.mkdirs();
        String tempFilename = "tmpaudio.3gp";

        final String tempDestFile = appTmpPath
            .getAbsolutePath() + "/" + tempFilename;
        Log.d("","temper destination file"+tempDestFile);
        mTts.synthesizeToFile(str, myHashRender,
                              tempDestFile);
        try {
            mediaPlayer.setDataSource(tempDestFile);
            mediaPlayer.prepare();
        } catch (IllegalArgumentException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IllegalStateException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        try{
            mediaPlayer.start();
        }catch(Exception e){
            System.out.println(""+e);

        }
    } else {
        try {
            Log.d("", "pause");

            mBtplay.setText(getString(R.string.pause_str));
            mediaPlayer.pause();
        } catch (Exception pa) {
            if (mediaPlayer != null) {
                mediaPlayer.stop();
                mediaPlayer.release();
            }

        }

    }   

}
</code></pre>
