Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

QTMovie to handle NSData of an mp3?



So the following works if I have a quicktime movie in a file that I
want to store as NSData:

   data = [[NSFileManager defaultManager] contentsAtPath:path];
   [self setValue:data forKey:@"data"];

then later on, I can do:

   NSData* data = [self valueForKey:@"data"];
   QTMovie* movie = [[QTMovie alloc] initWithData:data error:&err];

And everything works fine.

BUT, if the file is an mp3, when I try to load the NSData into a
QTMovie, I get an error "the file is not a movie file".

To get it to sort of work, I did this:

    QTMovie* movie = [[QTMovie alloc] initWithFile:path error:nil];
    data = [movie movieFormatRepresentation];
    [self setValue:data forKey:@"data"];

this "works" in that I can create a QTMovie from the data using the
second snippet above, but the NSData doesn't contain the full mp3
file, just a reference to the file (if I delete the mp3 file fully, it
doesn't work).

So, how can I get the full mp3 file into NSData that can be used to
create a QTMovie?

thanks for your help.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.