Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 12-21-2011, 01:13 AM   #1 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 64
oztemel is on a distinguished road
Default control same avaudioplayer each tab?

Hi I would like to control avaudioplayer in tabbar app. just one player and control that from each tab. how is it possible? like a background music. I would start player in first tab and jump to third tab etc.. pause the audio or jump to next song etc...

I don't know where can I start..

Do you have any suggestion / sample code ?
oztemel is offline   Reply With Quote
Old 12-21-2011, 02:43 AM   #2 (permalink)
Just helping out.
 
Domele's Avatar
 
Join Date: Feb 2011
Posts: 2,565
Domele is on a distinguished road
Default

I would just add the audio player as an ivar of your app delegate. The app delegate can be accessed from anywhere so you can also access your audio player.
__________________
If you are looking for a quality developer, I'm your man. Give me a PM if you are interested.

New app - See screenshots and details at www.globaclock.com.

If you want to thank me, click the link. Every click counts. If you want to do more, buy my app. A link is available on my website. Thanks.
Domele is offline   Reply With Quote
Old 12-21-2011, 02:47 AM   #3 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 64
oztemel is on a distinguished road
Default

Quote:
Originally Posted by Domele View Post
I would just add the audio player as an ivar of your app delegate. The app delegate can be accessed from anywhere so you can also access your audio player.
Do you have any sample code?
oztemel is offline   Reply With Quote
Old 12-21-2011, 04:09 AM   #4 (permalink)
Just helping out.
 
Domele's Avatar
 
Join Date: Feb 2011
Posts: 2,565
Domele is on a distinguished road
Default

Just add an ivar to your app delegate, create a property for it, and initialize it in appDidFinishLaunching. Then you can get your app delegate via UIApplication. UIApplication is a singleton object which means only one instance exists at any one time. You get this shared instance by calling sharedApplication.
Code:
UIApplication *app = [UIApplication sharedApplication];
A UIApplication object has a delegate.
Code:
UIApplication *app = [UIApplication sharedApplication];
YourAppDelegateClassName *appDelegate = app.delegate;
AVAudioPlayer *player = appDelegate.globalAudioPlayer;
Hope that helps. All you need to do is add an ivar, create a property for it, and initialize it in appDidFinishLaunching. If you don't know what a property is, look at Brian Slick's guide to properties, you can find the link in his signature.
__________________
If you are looking for a quality developer, I'm your man. Give me a PM if you are interested.

New app - See screenshots and details at www.globaclock.com.

If you want to thank me, click the link. Every click counts. If you want to do more, buy my app. A link is available on my website. Thanks.
Domele is offline   Reply With Quote
Old 12-21-2011, 02:06 PM   #5 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 64
oztemel is on a distinguished road
Default

Quote:
Originally Posted by Domele View Post
Just add an ivar to your app delegate, create a property for it, and initialize it in appDidFinishLaunching. Then you can get your app delegate via UIApplication. UIApplication is a singleton object which means only one instance exists at any one time. You get this shared instance by calling sharedApplication.
Code:
UIApplication *app = [UIApplication sharedApplication];
A UIApplication object has a delegate.
Code:
UIApplication *app = [UIApplication sharedApplication];
YourAppDelegateClassName *appDelegate = app.delegate;
AVAudioPlayer *player = appDelegate.globalAudioPlayer;
Hope that helps. All you need to do is add an ivar, create a property for it, and initialize it in appDidFinishLaunching. If you don't know what a property is, look at Brian Slick's guide to properties, you can find the link in his signature.
Thank you for your assist.. I think that's too much for me.. I will try..
oztemel is offline   Reply With Quote
Reply

Bookmarks

Tags
avaudioplayer, mp3, tab, tabbar

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 393
13 members and 380 guests
7twenty7, AppsBlogger, Creativ, Dalia, David-T, Duncan C, HemiMG, heshiming, LunarMoon, Murphy, pbart, teebee74, Tomsky
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,676
Threads: 94,127
Posts: 402,915
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jleannex55
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 06:50 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0