我尝试使用vitamio库显示视频,但它需要文件路径。我也从sdcard文件夹中获取文件路径。它显示了这种类型的错误:
07-15 18:09:12.229:E / Vitamio [4.2.6]球员: avformat_open_input:没有这样的文件或目录:-2
private String path = Constant.FILE_PATH;
private VideoView mVideoView;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
if (!LibsChecker.checkVitamioLibs(this))
return;
setContentView(R.layout.videoview);
mVideoView = (VideoView) findViewById(R.id.surface_view);
if (path == "") {
// Tell the user to provide a media file URL/path.
Toast.makeText(
VideoViewDemo.this,
"Please edit VideoViewDemo Activity, and set path"
+ " variable to your media file URL/path",
Toast.LENGTH_LONG).show();
return;
} else {
/*
* Alternatively,for streaming media you can use
* mVideoView.setVideoURI(Uri.parse(URLstring));
*/
mVideoView.setVideoPath(Constant.FILE_PATH);
mVideoView.setMediaController(new MediaController(this));
mVideoView.requestFocus();
mVideoView
.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mediaPlayer) {
// optional need Vitamio 4.0
mediaPlayer.setPlaybackSpeed(1.0f);
}
});
}
}
我不知道文件路径有什么问题。 vitamio库在我的应用程序中不显示任何类型的视频。