0

I fetch the video url from firebase and I am able to download it to my device properly. I used this to do so. The problem is that I want to share the downloaded video immediately inside my app and don't want to go to my camera roll. I try to use the UIActivityViewController to do so and photos work fine.

I haven't found out a way to access the created asset I downloaded (see link above). currently I am only sending the url where a user can see the video like this : "https://firebasestorage.googleapis.com/v0/b/funcloud-8e84e.appspot.com/o/Posts%2F49DD8F34-EA03-45D1-A4D8-463049421A95?alt=media&token=caefd0c9-4a31-4616-9f58-fb769acf8103"

But instead I want to send the downloaded video as one like when you send a video via camera roll. Any idea?

Zash__
  • 293
  • 4
  • 16

1 Answers1

0

If you carefully check the link you posted for how you download the video file you will see it actually has a path where the file is being saved(or moved) on your device.

let destination = NSURL(string: NSString(format: "%@/%@", documentsPath, url!.lastPathComponent!) as String);
print(destination);

try? mgr.moveItemAtPath(location!.path!, toPath: destination!.path!)

You just have to check for your video file at that path('destination' in above code) and share it from there.

Refer here to check how to share video using path: Swift 2 - Share video with UIActivityViewController

Rishabh
  • 465
  • 5
  • 14
  • so this is the place I save the video : file:///private/var/mobile/Containers/Data/Application/5DC53BD3-A220-4038-ABD2-AD94F5A2698F/tmp/CFNetworkDownload_anKKOA.tmp – Zash__ Mar 01 '18 at 12:03
  • the destination url is : file:///var/mobile/Containers/Data/Application/7AE086CB-40FB-4CF6-8E84-526B591F049A/Documents/86FE3C07-A88C-4860-9B64-7404753C35DB.mov – Zash__ Mar 01 '18 at 14:33
  • The path with .mov extension is the path for your video. You can share that file with UIActivityViewController. – Rishabh Mar 02 '18 at 13:12
  • I tried it but it doesn't work its still just the link – Zash__ Mar 02 '18 at 16:36
  • Please share some of your code for UIActivityViewController – Rishabh Mar 04 '18 at 03:55