Android libVLC - 文件路径而不是 URL 错误
Android libVLC - file path instead of URL error
我使用来自 here 的 Gary 示例。
唯一的修改是我像这样加载本地视频:
mMediaUrl = "/storage/emulated/0/MyFolder/20161003_1217.mp4";
我收到以下错误:
10-03 12:54:13.588 16681-17397/windylabs.com.vlcplayersample E/VLC-std: Warning: input_item_SetURI("/storage/emulated/0/MyFolder/20161003_1217.mp4"): file path instead of URL.
10-03 12:54:13.588 16681-17397/windylabs.com.vlcplayersample E/VLC-std: input_SplitMRL("/storage/emulated/0/MyFolder/20161003_1217.mp4") probably not a valid URI!
10-03 12:54:15.718 16681-17399/windylabs.com.vlcplayersample E/VLC: [dece4214] core input: open of `/storage/emulated/0/MyFolder/20161003_1217.mp4' failed
10-03 12:54:15.728 16681-17399/windylabs.com.vlcplayersample E/VLC: [dece4214] core input: Your input can't be opened
10-03 12:54:15.728 16681-17399/windylabs.com.vlcplayersample E/VLC: [dece4214] core input: VLC is unable to open the MRL '/storage/emulated/0/MyFolder/20161003_1217.mp4'. Check the log for details.
我不知道错误指定的日志在哪里。该示例使用从 here 流式传输的视频,它正在运行,但无法播放来自我的 sdcard 的视频!
试试这个
mMediaUrl = "/sdcard/MyFolder/20161003_1217.mp4";
或检查清单中的 READ_EXTERNAL_STORAGE
权限。
我找到了解决方案,可能会在某个时候帮助别人。
您需要这样加载文件:
mMediaUrl = Uri.fromFile(pathToMediaFile).toString();
我使用来自 here 的 Gary 示例。
唯一的修改是我像这样加载本地视频:
mMediaUrl = "/storage/emulated/0/MyFolder/20161003_1217.mp4";
我收到以下错误:
10-03 12:54:13.588 16681-17397/windylabs.com.vlcplayersample E/VLC-std: Warning: input_item_SetURI("/storage/emulated/0/MyFolder/20161003_1217.mp4"): file path instead of URL.
10-03 12:54:13.588 16681-17397/windylabs.com.vlcplayersample E/VLC-std: input_SplitMRL("/storage/emulated/0/MyFolder/20161003_1217.mp4") probably not a valid URI!
10-03 12:54:15.718 16681-17399/windylabs.com.vlcplayersample E/VLC: [dece4214] core input: open of `/storage/emulated/0/MyFolder/20161003_1217.mp4' failed
10-03 12:54:15.728 16681-17399/windylabs.com.vlcplayersample E/VLC: [dece4214] core input: Your input can't be opened
10-03 12:54:15.728 16681-17399/windylabs.com.vlcplayersample E/VLC: [dece4214] core input: VLC is unable to open the MRL '/storage/emulated/0/MyFolder/20161003_1217.mp4'. Check the log for details.
我不知道错误指定的日志在哪里。该示例使用从 here 流式传输的视频,它正在运行,但无法播放来自我的 sdcard 的视频!
试试这个
mMediaUrl = "/sdcard/MyFolder/20161003_1217.mp4";
或检查清单中的 READ_EXTERNAL_STORAGE
权限。
我找到了解决方案,可能会在某个时候帮助别人。
您需要这样加载文件:
mMediaUrl = Uri.fromFile(pathToMediaFile).toString();