QTMovie Allocate problem, turns out null SOMETIMES

217 views Asked by At

So i have this wierd error in my program where i have a QTMovieView that shuffles between movies, this works perfect. And in another part of the program you can record some videos that shows in the video shuffler later. This is where i can get problems.

Sometimes like 75% of the time when the videoloop tries to allocate one of the new videos it returns null. But if i restart my program there is no problem with showing these videos.

Since the video files are in the right place, the call is exactly the same it think its wierd that it only works sometimes after record, and always if i restart my application.

The code below is the one that i use to load my videos, fileName is right, and the file exists in where its looking. And it always works after i restart the program. But not always directly after recording a new video.

The error i get out from it is Error Domain=NSOSStatusErrorDomain Code=-50 "The operation couldn’t be completed. (OSStatus error -50.)" (error in user parameter list)

        NSString *moviePath = [NSBundle pathForResource:fileName ofType:@"mov" inDirectory:@"/Users/Shared/Real/Movies"];
        QTMovie *movie = [[QTMovie alloc] initWithFile:moviePath error:nil];

        NSLog(@"fil att leta efter: %@",fileName); //the right filename
        NSLog(@"vald film resultat: %@",movie); // Turns out (null) if the file is recorded in the same session
1

There are 1 answers

0
tobros91 On BEST ANSWER

Okay solved it, problem was that NSBundle didn't find the new files that where written to the folder. Dont know why it doesn't but did replaced it with NSString* stringMoviePath = [NSString stringWithFormat:@"/Users/Shared/Real/Movies/%@.mov",fileName]; and now its all good