Is it possible to play sound before / during the splash screen?

My app takes a few seconds to load and I have a splash screen. After "viewDidLoad" I have a little sound play. I feel like the sound will be better used if it starts playing when the splash screen appears. Is it possible to play sound before / during 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!

+2


source to share


3 answers


A little trick is to use the same splash screen as your Default.png, making it seamlessly transition into the code you control. When applicationDidLaunch is called, start playing the sound and display the splash screen. If you want, you can add a small progress bar to the splash screen. In viewDidLoad, when you're done with all the initialization, do 2-5 seconds or so for the splash screen to fade out. You can enter a code to close the splash screen with a tap, thus giving people some time to read the splash screen or touch it to cancel it. All of this makes the time that Default.png displays without sound seems insignificant.



+4


source


You can display your own splash screen and download the app in the background. That way, once applicationDidLauch is done, you can display your own screen and splash sound and then load the rest while the user sees it.



+1


source


I like it when you leave the splash screen a little longer to play the sound, but be careful, you mess with the HIG guidelines that say, "Avoid showing an" O "window, splash screen, or providing any other type of startup that allows people to use your app immediately ". (p. 45)

They also talk more about the boot image on page 123 and emphasize that they should NOT build your brand. However, you see it all the time and it is sometimes referred to as the "most frequently violated rule", but be careful, there is a line that you dance next to it.

0


source







All Articles