如何解决:java.io.FileNotFoundException:无内容提供者:

时间:2019-07-10 12:19:00

标签: java android android-mediaplayer android-videoview

我尝试从URL打开并播放视频文件,但是尝试时会出现异常。

  

java.io.FileNotFoundException:没有内容提供者:http://beispielseite.orgfree.com/video2.mp4

我尝试了不同的网址,但大多数网址无效,但是我找到了一个,其中也出现了例外,但视频播放:https://ia600201.us.archive.org/22/items/ksnn_compilation_master_the_internet/ksnn_compilation_master_the_internet_512kb.mp4

final VideoView videoView = (VideoView)findViewById(R.id.videoView);
System.out.println(link);
videoView.setVideoPath(" https://ia600201.us.archive.org/22/items/ksnn_compilation_master_the_internet/ksnn_compilation_master_the_internet_512kb.mp4");
videoView.start();
  

2019-07-10 14:10:16.607 22439-22439 / com.example.watchads W / MediaPlayer:无法打开https://ia600201.us.archive.org/22/items/ksnn_compilation_master_the_internet/ksnn_compilation_master_the_internet_512kb.mp4:java.io.FileNotFoundException:无内容提供者:{{3} }

1 个答案:

答案 0 :(得分:0)

您正在尝试加载本地视频,这就是为什么它说“找不到文件”的原因。

只需使用videoView.setVideoURI(video);

here是如何在Android的VideoView中显示在线视频的完整示例