Android:从内部存储播放视频时出现问题
我正在尝试使用以下代码播放视频文件:
MediaController mc = new MediaController(this);
mc.setAnchorView(videoView);
mc.setMediaPlayer(videoView);
Uri video = Uri.parse(path);
videoView.setMediaController(mc);
videoView.setVideoURI(video);
videoView.start();
对于位于 SD 卡上的视频,效果很好,但是当我尝试从内部存储播放视频时,它说无法播放视频。
现在,我认为(但不确定)这与内部存储中的视频可能没有必要的权限有关。
你怎么认为?
I'm trying to play a video file with this code:
MediaController mc = new MediaController(this);
mc.setAnchorView(videoView);
mc.setMediaPlayer(videoView);
Uri video = Uri.parse(path);
videoView.setMediaController(mc);
videoView.setVideoURI(video);
videoView.start();
With videos located on the SD card it works great, but when I try to play a video from the internal storage it says it's unable to play the video.
Now, I think (but not sure) it has something to do with the fact that maybe the videos in the internal storage don't have the necessary permissions.
What do you think?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Context.MODE_WORLD_WRITEABLE 并不意味着 Context.MODE_WORLD_READABLE。
也许您只想可读,但如果您确实想要两者,则可以将常量“或”在一起。
Context.MODE_WORLD_WRITEABLE does not imply Context.MODE_WORLD_READABLE.
Probably you only want only readable, but you can "or" the constants together if you do want both.