Android的媒体播放器错误(100,0)媒体播放器、错误、Android

2023-09-07 17:48:53 作者:乍见之欢

我看了所有的错误codeS在网络上给定的。

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

错误规定:

常量PVMFStatus PVMFInfoLast = 100; 占位符的范围内结束

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

但我没有能力处理这个错误,感谢帮助。

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

推荐答案

实施OnErrorListener上您的课。

Implement OnErrorListener to your class.

类体里面写

video_view.setOnErrorListener(this);

然后用这种方法覆盖方法的OnError(MediaPlayer的熔点,诠释了什么,整型附加)

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