So i download an .mp4 file using
urlData * =[NSData dataWithContentsOfUrl:filePath]
then save it using NSFileManager
[urlData writeToFile:filePath atomically:YES];
this saves the file in the NSFileManager directory just fine I can go into iTunes and see it, open and play the video so I know that part is working.
Here is where it breaks for me. I want to open and play these files, so i use like i use
[AVURLAsset URLAssetWithURL:filePath options:nil];
for some reason this always goes to a state of 'AVPlayerStatusFailed'. When I put a break point in and inspect the error I get 'unknown error'
Error Domain=NSURLErrorDomain Code=-1 "unknown error" UserInfo={NSLocalizedDescription=unknown error, NSUnderlyingError=0x1382f9630 {Error Domain=NSOSStatusErrorDomain Code=-12935 "(null)"}}
what am i missing here? or how can i get a better error than 'unknown error'
ok so as it turns out here is how i should have built the NSURL
[AVURLAsset URLAssetWithURL:[NSURL fileURLWithPath:filePath] options:nil];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With