I'd like to play sound file which loaded from internet, so I tried to start from iPhone SDK SpeakHere sample. I recorded the sound, then saved and uploaded to the internet, I could download that file and play without problem from sound tools. But when I tried to play that URL from SpeakHere, I am getting error Program received signal: “EXC_BAD_ACCESS”
.
After trace around, I found that the in -[AudioPlayer calculateSizesFor:]
, it set bufferByteSize
to a huge number 806128768, which caused buffer allocation failed.
And that because in
AudioFileGetProperty(audioFileID, kAudioFilePropertyPacketSizeUpperBound, &propertySize, &maxPacketSize);
The maxPacketSize
returned is 806128768.
I am wondering how to make AudioFileGetProperty
work.
My sound file is here http://chineseresume.com/localbiz/uploads/myfilename_7_Recording.caf, you could right mouse click and download from http://chineseresume.com/test.html
I am using this way to set the URL in the -[AudioViewController playOrStop]
method:
// AudioPlayer *thePlayer = [[AudioPlayer alloc] initWithURL: self.soundFileURL];
AudioPlayer *thePlayer = [[AudioPlayer alloc] initWithURL:
[NSURL URLWithString: @"http://chineseresume.com/localbiz/uploads/myfilename_7_Recording.caf"]];
Any suggestion is highly welcome. Thanks!