2

I have a short method which plays an audio notification using the AudioToolbox/AudioServices library (i've removed most of the functional code for brevity):

- (IBAction)thatWasEasy:(id)sender {

    NSBundle *mainBundle = [NSBundle mainBundle];
    NSString *filePath = [mainBundle pathForResource:@"easy" ofType:@"mp3"];
    NSURL *aFileURL = [NSURL fileURLWithPath:filePath isDirectory:NO];

    SystemSoundID soundID;
    AudioServicesCreateSystemSoundID((__bridge_retained CFURLRef)aFileURL, &soundID) ;
    AudioServicesPlaySystemSound(soundID);     
}

The audio plays correctly in the simulator as well as on iPad 1 and iPad 2 devices, however on the iPad 3 (Verizon LTE version) the sound is not heard. I've checked the devices sound settings thoroughly, and also converted the audio file type to wav, and caf with no difference in behavior.

Any suggestions on troubleshooting this a bit deeper? I unfortunately do not have another iPad 3 lying around for comparison. Appreciate the help!

ninehundreds
  • 1,097
  • 2
  • 21
  • 43

2 Answers2

0

Figured it out. When you go to [Settings] and select [Sounds] under the [General] tab you can verify that your ringer and alerts volume level is above zero, and when moving the slider the device will chime at the newly set level. In addition you will note that all of your specific tones are enabled in the list below. This is what threw me off when checking the device settings. I launched YouTube and other applications and was able to play sound just fine.

What I didn't realize until I spoke to another guy (who knows the product a little better), is that there is another method to mute system sounds. By pressing the circle button twice an icon bar is revealed on the bottom of the screen. If you drag the icons to the right with your finger a speaker icon is revealed. This happened to be muted for some reason...presumably after I performed a system restore recently. Tap it to un-mute and your back in business. Not sure why Apple designed it this way, but it would have been helpful (and saved me a few hours of tinkering) if it had been accessible under the device settings.

ninehundreds
  • 1,097
  • 2
  • 21
  • 43
0

I don't think you can play an mp3 file on the device using AudioServicesPlaySystemSound AudioServicesPlaySystemSound apple document

-(void)playAif:(NSString *)filename {
//  NSLog(@"play: %@", filename);

SystemSoundID soundID;
NSString *path = [[NSBundle mainBundle]
                  pathForResource:filename ofType:@"aif"];    


if (path) { // test for path, to guard against crashes

    UInt32 sessionCategory = kAudioSessionCategory_AmbientSound;    // 1

    AudioSessionSetProperty (
                             kAudioSessionProperty_AudioCategory,                        // 2
                             sizeof (sessionCategory),                                   // 3
                             &sessionCategory                                            // 4
                             );

    AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:path],&soundID);
    AudioServicesPlaySystemSound (soundID);

}
}
prashant
  • 1,920
  • 14
  • 26
  • Actually once I figured out the location of that sound toggle I re-tested the playback with all three audio types and they work great. You are correct based on Apple's documentation, but it still plays mp3's without issue. – ninehundreds Sep 04 '12 at 17:28
  • interesting i would like to try it. Thanks. – prashant Sep 04 '12 at 17:34
  • i thought you might known about "ringer and alerts volume level should be above zero" – prashant Sep 04 '12 at 17:39
  • It WAS above zero. I had it set mid-range. That setting has nothing to do with the lack of sound playback. – ninehundreds Sep 04 '12 at 17:45