可以通过插入以下网址来播放互联网上的视频:
mPath = Uri.parse("http://commonsware.com/misc/test2.3gp");
mVid.setVideoURI(mPath);
mVid.requestFocus();
mVid.start();
但是现在我在我的原始文件夹中有一个视频,所以路径是res/raw/testing.3gp。下面的代码不起作用
mPath = Uri.parse("../../res/raw/testing.3gp");
发布于 2018-02-07 14:36:01
可以这样
String videoName = nameWithoutFileExtention;
int id = getResources().getIdentifier(videoName, "raw", getActivity().getPackageName());
final String path = "android.resource://" + getActivity().getPackageName() + "/" + id;
vvBgVideo.setVideoURI(Uri.parse(path));
https://stackoverflow.com/questions/-100003470
复制相似问题