I have two viewcontrollers: GetStartedViewController (root viewController) and TrimVideoViewController. I pick a video from the root one using PHPicker and I need to play that video in the second viewController. The problem is that when I provide the url to AVFoundation nothing happens. I am at a loss.
I’ve scoured the internet and cannot find an answer to this.
I saw a single solution to this saying I need to copy and save to another directory and use that directory with AVFoundation. It still didn’t work.
I also searched for a framework that could maybe play videos from gallery, but most of them only played using HTTP links.
can anyone help me with this?
2
Answers
Okay, after consulting with a more experienced iOS developer, we found that the url that was being passed by PHPicker was not suitable for AVFoundation. Instead we wrote this function that relocates the video and makes it suitable for AVFoundation.
enjoy!
please take note that you have fetched the URL but you didn’t set
self.url = url
changing your
vc!.videoURL = url
to the following should make a difference