Discussion Forums  >  Audio, Video, Playing, Recording

Replies: 5    Views: 223

Mike the App Guy
Lost but trying
Profile
Posts: 435
Reg: Sep 19, 2011
Birmingham, Ala...
5,900
06/16/13 11:56 AM (10 years ago)

Play sound when app starts (play sound when app opens)

THANK YOU to the buzztouch community for helping me get my sounds in the quiz to work! It works fine now, and it's awesome!! Now, my follow up question is, can I play a sound when the app opens? I did a search and didn't see anything, but I could swear I have seen that there's a way to do this somewhere. Thank you!
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
06/16/13 08:25 PM (10 years ago)
The 'easiest' way would be to have your home screen play audio, but that will happen each and every time the home screen is loaded, which may be several times per use. "Not having tried it" I can't say whether it will work... but it seems like it should... Just a few lines down from where you load your sound effects, is a "playSoundEffect" method which, well, plays the audio. -(void)playSoundEffect:(NSString *)theFileName So what you will need to do is: 1) add the desired sound into your project 2) add the desired sound into the list of Sound Effects (as per previous discussion) 3) Find a good spot to 'play' the sound. 4) Enter the instruction to play the sound. If you only want it to play once, then I'd put it somewhere in a 'BT' file, such as your xxxx_appDelegate.m file, maybe somewhere toward the bottom of the method "applicationDidBecomeActive", perhaps right after the [self reportToCloud] call and before the 'locationManager' stuff. It will play once and only once when the app is active. Maybe there, maybe in the method 'applicationWillEnterForeground'... you'll need to play with it and find out which (if either) is a better fit. put in this instruction: [self playSoundEffect:@"myquiznoise.mp3"]; Keep in mind that would be 'static', and unchangeable. It's a 'quick and dirty' solution, probably not the best, but it should work. For something a bit more dynamic, you'll want to look into the audio properties, and how the screens change their music (something in BT_audioPlayer, I bet...) but I'm afraid I can't research all that for the moment... Your best solution would be to find a way to put in those 'music' values into your config file (I'm thinking either Json Snippet keeper, or perhaps a manual entry via the 'layout' options in your app control panel). You can add your own JSON keys and values like "startupSong":"myquiznoise.mp3" and then, after the config file gets downloaded to your app, in a fashion similar to the way BT Screens scrape off the information, you could do the same for your audio. This way, later if you decide to change it, you can. Cheers! -- Smug
 
farcat
buzztouch Evangelist
Profile
Posts: 1008
Reg: Jan 27, 2012
France
13,230
like
06/19/13 05:08 AM (10 years ago)
Thanks SMug, I was looking for this. Trying this right now! Farcat
 
farcat
buzztouch Evangelist
Profile
Posts: 1008
Reg: Jan 27, 2012
France
13,230
like
06/20/13 05:41 AM (10 years ago)
@Daniel, got any luck with this? Didn't work for me :( I am trying something a bit different now though, so I will do a separate post. Good luck! Farcat
 
arkietechs
Aspiring developer
Profile
Posts: 11
Reg: Sep 01, 2014
Jacksonville
7,010
like
02/16/16 09:59 PM (8 years ago)
Mike the App Guy SmugWimp farcat Did this ever work?
 
farcat
buzztouch Evangelist
Profile
Posts: 1008
Reg: Jan 27, 2012
France
13,230
like
02/17/16 01:08 PM (8 years ago)
Hi arkietechs, Nope, sorry, couldn't get it to work :) I tried different things but gave up after a while. Farcat
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.