【问题标题】:VideoView "can't play the video" errorVideoView“无法播放视频”错误
【发布时间】:2016-05-09 03:28:57
【问题描述】:

这里是my video,我可以在除 VideoView 之外的任何播放器上播放此视频(但我可以使用 MediaPlayer#setDataSource 播放),这是我的代码:

    VideoView vp = (VideoView) findViewById(R.id.player);
    vp.setVideoPath("/sdcard/videoRecorder/2016-05-09-10:31:42.mp4");

监视器只提供“未知错误”,如

05-09 11:22:53.173 4667-4683/ro.adr.test E/MediaPlayer: error (1, -2147483648)
05-09 11:22:53.339 4667-4667/ro.adr.test E/MediaPlayer: Error (1,-2147483648)

我希望找到一种方法使用VideoView播放这个视频,怎么做?

【问题讨论】:

    标签: android video


    【解决方案1】:

    文件名看起来很可疑。你能不能试着把它换成标准的再测试一次?即没有“:”

    您仍然可以使用 setVideoPath(string path),但需要确保路径是 uriString。下面是这个方法在 Android 中的实际实现。在传入之前,您需要先对字符串进行编码。

    public void setVideoPath(String path) {
        setVideoURI(Uri.parse(path));
    }
    

    uri 参考:http://developer.android.com/reference/android/net/Uri.html

    【讨论】:

    • 你是对的,当我将它重命名为 test.mp4 时,它可以工作,VideoView 太愚蠢了,你能告诉我更常见的方法,我的意思是让 VideoView 可以播放路径包括“: "
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-04-11
    • 1970-01-01
    • 1970-01-01
    • 2012-11-07
    • 2018-12-20
    • 1970-01-01
    相关资源
    最近更新 更多