【发布时间】:2018-02-09 02:42:26
【问题描述】:
我已设法将我的视频下载到设备上,但无法再次访问它以在我的应用程序上播放它。我正在使用生成的 uri 将我的视频引用回 videoView,但是在
处生成的 uriuri=downloadManager.getUriForDownloadedFile(reference);根据我的日志消息为空。
我做错了什么?
public void saveLocal(View v){
downloadManager= (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
String url= "http://adme360.otscom.net/tim10.mp4";
uris= Uri.parse(url);
DownloadManager.Request request= new DownloadManager.Request(uris);
request.setNotificationVisibility(Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
Long reference=downloadManager.enqueue(request);
Toast.makeText(this,""+reference,Toast.LENGTH_LONG);
uri= downloadManager.getUriForDownloadedFile(reference);
Log.d("REFERENCE", ""+uri);
}
public void playLocal(View v){
video.setVideoURI(uri);
video.start();
}
【问题讨论】:
-
你必须使用广播接收器
标签: java android android-studio