views:

277

answers:

4

My app takes a few seconds to load and I have a splash screen. Once "viewDidLoad" I have a little sound play. I feel that the sound would be in better use if it started playing when the splash screen popped up. Is it possible to have a sound start before/during the splash screen?

Here is my code: (under viewDidLoad)

NSString *soundFilePath = [[NSBundle mainBundle] pathForResource: @"intorSound" ofType: @"aif"];
  NSURL *fileURL = [[NSURL alloc] initFileURLWithPath: soundFilePath];
  player = [[AVAudioPlayer alloc] initWithContentsOfURL: fileURL error: nil];
  [player setVolume: soundVolumeValue];    // available range is 0.0 through 1.0
  [player play];

  [fileURL release];

Thank you for your time!

+1  A: 

You can display your own splash screen and load your app in the background. This way, as soon as applicationDidLauch is done, you can display your own splash screen and sound, then load the rest while the user sees this.

coneybeare
Thank you. But I would like the sound to start to play as soon as the app first starts.
Jeff
you cant. You can only make that time between the default.png and your code execution smaller.
coneybeare
thats what i thought Thank you very much
Jeff
A: 

Nope, you can't.

Nick Veys
+3  A: 

A little trick is to use the same splash screen as your Default.png, making a seamless transition into code you control. When applicationDidLaunch gets called, start your sound playback, and display the splash screen. If you want, you can put a little progress indicator up onto the splash screen as well. In viewDidLoad, when you are done with all initialization, do a 2-5 second or so fade of the splashscreen. You can throw in code to dismiss the splash screen with a tap, thus giving people some time to read the splash screen or tap it to dismiss it. This all makes the amount of time that the Default.png is displayed with no sound seem insignificant.

mahboudz
One second max...two to five seconds is forever!
chpwn
True, but if your splash screen is something you want the user to read, then you need to give their eyes enough time. If all you are putting up is a logo, or a graphic, then shorter is better. Keep in mind, you can dismiss the screen and its fadeout with a tap, that way users can get on with using your app as soon as the app is loaded. Also, if you feel that the users will not need as much time to read the splash screen after the first few times, then you can lessen the time, when it is being displayed for the nth time or more.
mahboudz
A: 

I like the technique of leaving the splash screen up a little longer to play the sound, but beware you are messing with HIG guidelines which state "Avoid displaying an About window, a splash screen, or providing any other type of startup experience that prevents people from using your application immediately." (p. 45)

They also talk more about the startup image on p. 123 and stress it's NOT supposed to build your brand. However you see this all the time, and it is sometimes called the "most-often broken rule" - but beware there is a line you are dancing next to it.