views:

754

answers:

1

Hello,

I initialize my AVAudioPlayer instance like:

[self.audioPlayer initWithContentsOfURL:url error:&err];

url contains the path of an .m4a file

The following error is displayed in the console when this line is called :"Error Domain=NSOSStatusErrorDomain Code=1685348671 "Operation could not be completed. (OSStatus error 1685348671.)"

What is the reason for this error?

+1  A: 

The error code is a four-char-code for "dta?" (you can use the Calculator app in programmer mode to convert the int values to ASCII). Check the "result codes" of the various Core Audio references and you'll find this is defined in both Audio File Services and Audio File Stream Services as kAudioFileInvalidFileError or kAudioFileStreamError_InvalidFile respectively, both of which have the same definition:

The file is malformed, not a valid instance of an audio file of its type, or not recognized as an audio file. Available in iPhone OS 2.0 and later.

Have you tried your code with different .m4a files?

invalidname
Also, as this is a Core Audio error, you should add the core-audio tag to your question. Thanks.
invalidname
@invalidname, thanks for ur answer. Can you explain why does this occur with .m4a? My other files like .caf and .aiff do not give any initialization problem, but when i use any .m4a file, this error arises. Does AVAudioPlayer not work with .m4a?
CodeWriter
@Vaish: are these m4a's from the iTunes store? I've had no problem playing unprotected iTunes m4a files on the device or in the simulator.
invalidname