Question

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!

Was it helpful?

Solution

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.

OTHER TIPS

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.

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top