1

我尝试使用 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 库不会在我的应用程序中显示任何类型的视频。

4

0 回答 0