Discussion Forums  >  Self Hosted Control Panels

Replies: 13    Views: 84

teamcaz
I hate code!
Profile
Posts: 513
Reg: Jun 12, 2011
carlsbad
5,130
02/25/13 08:49 AM (12 years ago)

How to make audio keep playing?

Good morning all, I am using the plugin "blog pro" which is great by the way... I am using it to play audio files, they play great and the app is in que to be reviewed. I was listening to one of the files this morning and when the phone goes into time out the audio stops! Is there a way to fix this? Is there a setting to keep the audio to keep playing or something? Thank you for any info or advice! Cole
 
LA
Aspiring developer
Profile
Posts: 3280
Reg: Aug 16, 2012
Jerseyville, IL
42,900
like
02/25/13 08:57 AM (12 years ago)
Hey @teamcaz, Not sure about the blog pro, but pretty sure you can with stream audio plugin, unless you code it. LA
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
02/25/13 09:06 AM (12 years ago)
Here's a post about disabling auto lock http://www.buzztouch.com/forum/thread.php?tid=60691FF19143FCEC2F853FC&currentPage=2 there have been a number of posts about it, have a little google for it
 
teamcaz
I hate code!
Profile
Posts: 513
Reg: Jun 12, 2011
carlsbad
5,130
like
02/25/13 11:46 AM (12 years ago)
Ive tried a few of these things and nothing works... each time the phone goes into sleep mode or the screen shuts-off the audio stops... here is just a bit of code I found, does anyone know if its here that I change something? //stop audio -(void)stopAudio{ [BT_debugger showIt:self:[NSString stringWithFormat:@"stopAudio%@", @""]]; //must have audio player if(self.audioPlayer != nil){ //update the image [buttonStartStop setImage:[UIImage imageNamed:@"audioOff.png"] forState:UIControlStateNormal]; //stop audio [self.audioPlayer stop]; //flag as playing [self setAudioIsPlaying:FALSE]; //kill audio timer if(self.audioPlaybackTimer != nil){ [self.audioPlaybackTimer invalidate]; self.audioPlaybackTimer = nil; } //show stopped.. [self updateStatusLabel:NSLocalizedString(@"audioStopped", "audio stopped")];
 
Rad Doc
Apple Fan
Profile
Posts: 653
Reg: Oct 08, 2010
USA, NYC
8,580
like
02/25/13 12:19 PM (12 years ago)
There are a few changes you need to do to make sure you correct the mute/silent issue before you publish it to the appstore and get negative reviews. Step 1. In your Xcode Project find your BT_Config folder, in this folder you will find yourAppName_appDelegate.m file....scroll down pretty far in this file to around line 880 just after the array list of .mp3 sound effects you will see this code //setup audio session for background sounds. Allow iPod to continue if it's already playing. [[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryAmbient error: nil]; [[AVAudioSession sharedInstance] setActive: YES error: nil]; NOW just after that code paste the code below...you should now have audio and video playing regardless of mute switch on side of device...i tested and worked for me. // prevent mute switch from switching off audio from movie player NSError *_error = nil; [[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback error: &_error]; Step 2. Make sure you do this after you correct the mute issue. This will allow for your music to continue streaming even when you lock your phone. https://www.buzztouch.com/forum/thread.php?tid=09859FB7B6A1B6013162760&command=isSearching&currentPage=1&topicTitle=&createdBy=lsills81&repliedBy=&minViews=-1&maxViews=-1&minReplies=-1&maxReplies=-1&forumCategory=
 
teamcaz
I hate code!
Profile
Posts: 513
Reg: Jun 12, 2011
carlsbad
5,130
like
02/25/13 12:28 PM (12 years ago)
Ive tried a few of these things and nothing works... each time the phone goes into sleep mode or the screen shuts-off the audio stops... here is just a bit of code I found, does anyone know if its here that I change something? //stop audio -(void)stopAudio{ [BT_debugger showIt:self:[NSString stringWithFormat:@"stopAudio%@", @""]]; //must have audio player if(self.audioPlayer != nil){ //update the image [buttonStartStop setImage:[UIImage imageNamed:@"audioOff.png"] forState:UIControlStateNormal]; //stop audio [self.audioPlayer stop]; //flag as playing [self setAudioIsPlaying:FALSE]; //kill audio timer if(self.audioPlaybackTimer != nil){ [self.audioPlaybackTimer invalidate]; self.audioPlaybackTimer = nil; } //show stopped.. [self updateStatusLabel:NSLocalizedString(@"audioStopped", "audio stopped")];
 
Rad Doc
Apple Fan
Profile
Posts: 653
Reg: Oct 08, 2010
USA, NYC
8,580
like
02/25/13 12:30 PM (12 years ago)
Follow exactly as i listed above. That will solve your problem.
 
teamcaz
I hate code!
Profile
Posts: 513
Reg: Jun 12, 2011
carlsbad
5,130
like
02/25/13 01:05 PM (12 years ago)
Ive tried a few of these things and nothing works... each time the phone goes into sleep mode or the screen shuts-off the audio stops... here is just a bit of code I found, does anyone know if its here that I change something? //stop audio -(void)stopAudio{ [BT_debugger showIt:self:[NSString stringWithFormat:@"stopAudio%@", @""]]; //must have audio player if(self.audioPlayer != nil){ //update the image [buttonStartStop setImage:[UIImage imageNamed:@"audioOff.png"] forState:UIControlStateNormal]; //stop audio [self.audioPlayer stop]; //flag as playing [self setAudioIsPlaying:FALSE]; //kill audio timer if(self.audioPlaybackTimer != nil){ [self.audioPlaybackTimer invalidate]; self.audioPlaybackTimer = nil; } //show stopped.. [self updateStatusLabel:NSLocalizedString(@"audioStopped", "audio stopped")];
 
teamcaz
I hate code!
Profile
Posts: 513
Reg: Jun 12, 2011
carlsbad
5,130
like
02/25/13 01:13 PM (12 years ago)
Rad Doc, thank you for taking the time to help... so I followed the instructions exactly and it still stops playing audio if the phone goes asleep or you exit the app... the only step that I had difficulty with was when I add the UIBackround modes in the info.plist and choose 0 and array, it then says to go over to the right drop down arrow and choose app plays audio... my drop down menu doesnt have that option... could this all be because this is a 2.0 app?
 
Rad Doc
Apple Fan
Profile
Posts: 653
Reg: Oct 08, 2010
USA, NYC
8,580
like
02/25/13 01:15 PM (12 years ago)
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
02/25/13 02:29 PM (12 years ago)
I had the same problem. My solution is in this post https://www.buzztouch.com/forum/thread.php?tid=5B7E76702DC6789D948E174
 
teamcaz
I hate code!
Profile
Posts: 513
Reg: Jun 12, 2011
carlsbad
5,130
like
02/25/13 04:44 PM (12 years ago)
Thank you for this I will try it now...
 
teamcaz
I hate code!
Profile
Posts: 513
Reg: Jun 12, 2011
carlsbad
5,130
like
02/25/13 08:10 PM (12 years ago)
AlanMac you are my hero! problem solved!
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
02/26/13 02:27 AM (12 years ago)
Cheers Cole, glad I could help
 

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.