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

时间:2022-05-08 19:00:14

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

我已经阅读了网上给出的所有错误代码。

Error specifies:

错误指定:

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

const PVMFStatus PVMFInfoLast = 100;"范围结束占位符"

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

但是我没能处理好这个错误,谢谢你的帮助。

2 个解决方案

#1


12  

Implement OnErrorListener to your class.

为类实现OnErrorListener。

inside the class body write

在类主体内写

video_view.setOnErrorListener(this);

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

然后用这个方法覆盖方法OnError(MediaPlayer mp, int what, int extra)

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

#2


8  

I faced with this problem on Android 1.5.

我在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.

当mp3文件持续时间小于1秒时发生。这是一个android.media。媒体播放器。

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

解决方案是让mp3文件持续时间超过1秒。

#1


12  

Implement OnErrorListener to your class.

为类实现OnErrorListener。

inside the class body write

在类主体内写

video_view.setOnErrorListener(this);

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

然后用这个方法覆盖方法OnError(MediaPlayer mp, int what, int extra)

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

#2


8  

I faced with this problem on Android 1.5.

我在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.

当mp3文件持续时间小于1秒时发生。这是一个android.media。媒体播放器。

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

解决方案是让mp3文件持续时间超过1秒。