Reputation: 393
just simple peace of code (file 1.mp3 clicked and playing as well in iTunes) :
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
NSError *outError = nil;
QTMovie *newMovie = [QTMovie movieWithURL:[NSURL URLWithString:@"/Users/Alex/1.mp3"] error:&outError];
if (newMovie) {
//[newMovie setAttribute:[NSNumber numberWithBool:YES] forKey:QTMovieEditableAttribute];
[self setMovie:newMovie];
}
[movie play];
give me error
Upvotes: 0
Views: 533
Reputation: 22958
You need to create a file:
-based NSURL
using fileURLWithPath:
, not URLWithString:
. URLWithString:
is meant for URLs like http:
, etc.
Try:
QTMovie *newMovie = [QTMovie movieWithURL:
[NSURL fileURLWithPath:@"/Users/Alex/1.mp3"] error:&outError];
Upvotes: 1
Reputation: 34195
Changing
[movie play];
to
[movie autoplay];
might help you. QTMovie
loads the data in the background, so asking it to play right after it's created might be too quick for the QTMovie
to really play the file.
Upvotes: 1