Frank
Frank

Reputation: 309

Sounds plays in simulator (iPhone & iPad) and on an actual iPhone but not an actual iPad

I'm playing an mp3 file when the user flips a page using the code below. This works fine in the simulator on both the iPhone and the iPad (iOs 4,5, and 5.1). When I test on the device it works fine on the iPhone but I get no sound on the iPad. I've tried on two different iPads and still no luck. I've checked filenames and filepaths and everything is good. Again everything works fine on both in the Simulator. Any ideas why this is happening?

audioFilename = @"pageflip";
audioData = [NSData dataWithContentsOfMappedFile:[[NSBundle mainBundle] pathForResource:audioFilename ofType:@"mp3"]];
[audioData getBytes:soundBuffer length:128];
Audio1 = [[AVAudioPlayer alloc] initWithData:
audioData error:&error];
Audio1.numberOfLoops = 0;
Audio1.volume=0.9;
[Audio1 prepareToPlay];

Audio1.currentTime=0;
[Audio1 play];

Upvotes: 0

Views: 192

Answers (1)

Ram G.
Ram G.

Reputation: 3125

Files names on device are case sensitive. Please check the file name in resource and code.

Upvotes: 1

Related Questions