1

I would like to play the sound, and only the sound of a video I have recorded with the ipad camera. The file is a .mov file.

I successfully play the sound of .mp4 files. I will show you how I do it for mp4 files.

There are 2 members of my player class. audioPlayer a AVAudioPlayer and _urlOfVideoToPlay a NSURL with a local video.

NSError *audioError;
audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:_urlOfVideoToPlay error:&audioError];
bool prep2play = [audioPlayer prepareToPlay];

NSLog(@"%i", prep2play);

if(audioError) {
    NSLog([audioError localizedDescription]);
}

The result is:

2012-09-21 14:50:23.312 AppName[2201:907] 0
2012-09-21 14:50:23.315 AppName[2201:907] The operation couldn’t be completed. (OSStatus error 1954115647.)

First output is 0, that means prep2play is NO (false). Second output is error.

Do you may have any ideas on that?

Regards

rcpfuchs
  • 792
  • 1
  • 12
  • 26
  • Check if this helps you. http://stackoverflow.com/questions/4901709/iphone-avaudioplayer-unsupported-file-type – TheAmateurProgrammer Sep 21 '12 at 14:11
  • Thanks for your help, but I am sorry again, the solution on this link was to use initWithContentsOfURL instead of initWithData (if i understand you right). so i turned it around and used initWithData, because i already use initWithContentOfURL. but this did not work either, also lead in an Received Memory Warning :-( – rcpfuchs Sep 21 '12 at 14:41
  • Can you log the path of the URL? – TheAmateurProgrammer Sep 21 '12 at 14:42
  • i do that with NSLog([_urlOfVideoToPlay absoluteString]); yes the video that makes the error comes from file://localhost/var/mobile/Applications/C7480810-D7D2-479A-9E2E-0BD6C59F54C9/Documents/cameraRoll.mov and a video that works comes from file://localhost/var/mobile/Applications/C7480810-D7D2-479A-9E2E-0BD6C59F54C9/Documents/youtube.mp4 :-) – rcpfuchs Sep 21 '12 at 14:51
  • AVAudioPlayer does not support .MOV files: http://stackoverflow.com/questions/1761460/supported-audio-file-formats-in-iphone – Or Arbel Apr 10 '13 at 13:31

0 Answers0