我已经阅读了网站上提供的所有错误代码。
错误指定为:
常量PVMFInfoLast = 100;“范围结束的占位符”
但我无法处理此错误,感谢您的帮助。
我已经阅读了网站上提供的所有错误代码。
错误指定为:
常量PVMFInfoLast = 100;“范围结束的占位符”
但我无法处理此错误,感谢您的帮助。
将OnErrorListener实现到您的类中。
在类主体中编写以下内容:
video_view.setOnErrorListener(this);
然后用这个方法覆盖 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;
}
我在 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)
当mp3文件持续时间少于1秒时会发生这种情况。这是android.media.MediaPlayer
的一个bug。
解决方案是使mp3文件的持续时间大于1秒。