Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Media Player Error (100,0)

I have read all the error codes given on the web.

Error specifies:

const PVMFStatus PVMFInfoLast = 100; " Placeholder for end of range"

But I didn't able to handle this error, thanks for helping.

like image 615
Pranav Sharma Avatar asked Aug 16 '12 11:08

Pranav Sharma


2 Answers

Implement OnErrorListener to your class.

inside the class body write

video_view.setOnErrorListener(this);

then overwrite the method OnError(MediaPlayer mp , int what , int extra) with this method

@Override
public boolean onError(MediaPlayer mp, int what, int extra) 
{
    if (what == 100)
    {
        video_view.stopPlayback();
        Intent inn = new Intent(HelloInterruptVideoStream.this,TabAct.class);
        startActivity(inn);
    }
    else if (what == 1)
    {
        pb2.setVisibility(View.GONE);
        Log.i("My Error ", "handled here");
        video_view.stopPlayback();
        Intent inn = new Intent(HelloInterruptVideoStream.this,TabAct.class);
        startActivity(inn);
    }
    else if(what == 800)
    {
        video_view.stopPlayback();
        Intent inn = new Intent(HelloInterruptVideoStream.this,TabAct.class);
        startActivity(inn);
    }
    else if (what == 701)
    {
        video_view.stopPlayback();
        Intent inn = new Intent(HelloInterruptVideoStream.this,TabAct.class);
        startActivity(inn);
    }
    else if(what == 700)
    {
        video_view.stopPlayback();

        Toast.makeText(getApplicationContext(), "Bad Media format ", Toast.LENGTH_SHORT).show();
        Intent inn = new Intent(HelloInterruptVideoStream.this,TabAct.class);
        startActivity(inn);
    }

    else if (what == -38)
    {
        video_view.stopPlayback();
        Intent inn = new Intent(HelloInterruptVideoStream.this,TabAct.class);
        startActivity(inn);
    }
    return false;
}
like image 59
Pranav Sharma Avatar answered Oct 04 '22 04:10

Pranav Sharma


I faced with this problem on Android 1.5.

mMP = new MediaPlayer();
mMP.setOnCompletionListener(new CompletionListener());
mMP.setOnErrorListener(new ErrorListener());    
final FileInputStream fileInStream = new FileInputStream(mFileName);    
mMP.setDataSource(fileInStream.getFD());        
mMP.prepare();
mMP.play();
01-14 01:57:26.248: W/MediaPlayer(1971): MediaPlayer server died!
01-14 01:57:26.258: E/MediaPlayer(1971): error (100, 0)
01-14 01:57:26.258: E/MediaPlayer(1971): Error (100,0)

It happens when mp3 files duration is less than 1 second. This is an android.media.MediaPlayer bug.

The solution is to make mp3 files duration more than 1 second.

like image 27
p37td8 Avatar answered Oct 04 '22 04:10

p37td8