1

I am facing a very strange problem when I try to retrieve a video from cache. I use AndroidVideoCache which works perfectly. My code to store the file:

HttpProxyCacheServer proxy = getProxy(getApplicationContext());
String proxyUrl = proxy.getProxyUrl(url);
videoView.setVideoPath(proxyUrl);

...

I can see the files cached in the phone, Path: /storage/emulated/0/Android/data/[packagename]/cache/video-cache/video.mp4 When I replay the video, it comes in a second. Everything works perfectly. Now, I want to share this video on facebook. Code to share it:

ShareDialog shareDialog = new ShareDialog(DisplayVideos.this);
File file = new File("/storage/emulated/0/Android/data/[Packagename]/cache/video-cache/video.mp4");
Uri local = Uri.fromFile(file);
ShareVideo video = new ShareVideo.Builder().setLocalUrl(local).build();
ShareVideoContent videoContent = new ShareVideoContent.Builder().setVideo(video).build();
shareDialog.show(videoContent);

But then, I receive an exception !

com.facebook.internal.NativeAppCallAttachmentStore: Got unexpected 
exception:java.io.FileNotFoundException: 
/file:/storage/emulated/0/Android/data/[Packagename]/cache/video-cache/video.mp4

The video is 9M, all permissions are ok, and provider set for the app in AndroidManifest. I have been stuck for 2 days now and I woud like to know what I am doing wrong and if someone have had similar problem before. Help would be highly apreciated.

moi
  • 45
  • 1
  • 4
  • Related: [FileProvider](https://stackoverflow.com/questions/18249007/how-to-use-support-fileprovider-for-sharing-content-to-other-apps) – Ricardo A. Oct 03 '19 at 14:27

0 Answers0