t1w
t1w

Reputation: 1428

How to play audio file in launch screen in swift

I'm trying to play a 4 seconds long .mp3 file in my swift application's launch screen. I know how to play the .mp3 file but the thing i don't know is where to put that code in order to play the file while user see launch screen. Which file i should use for this? I created a swift file and set it as the class of launch screen's .xib but it didn't work out.

Upvotes: 0

Views: 1067

Answers (1)

Shreyank
Shreyank

Reputation: 1549

Option 1 : You can load one ViewController at launching of app.

That VC have Splash image and will remain till you sound file is execute. Code of playing sound will contain in this VC only.

Option 2 : Code of play sound is AppDelegate's didFinishLaunchingWithOptions method. and make window visible after finish of your sound.

Second option, I had not practically tried.

Upvotes: 2

Related Questions