Search code examples
androidandroid-mediaplayerandroid-video-player

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.


Solution

  • 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;
    }