Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

yutamic

macrumors newbie
Original poster
Jan 13, 2009
8
0
I'm trying to figure out a way so I can STOP my audio session
if a view is changed using the tab bar controller.

To make things clear, I'm using a Tab Bar Controller to switch views.
One view is a page where you can play audio (AVAudioPlayer),
and another view plays movie (MPMoviePlayer).

The problem is, when the audio is playing on one view,
and if I try to play the movie on the other view (while the audio is playing),
somehow the audio session function dies after the movie finishes playing.
It won't let me play the audio anymore even if I go back to the view that plays Audio.

So if I can somehow force the audio to stop before the Movie starts playing
I will be able to save the Audio session from being destroyed.

Any idea how I should solve this problem??
I've tried many different approach but couldn't fix this bug...
 

jnic

macrumors 6502a
Oct 24, 2008
567
0
Cambridge
Add an MPMoviePlayerContentPreloadDidFinishNotification to your movie player and use it to turn off your audio player.

Code:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(yourMethodHere:) name:MPMoviePlayerContentPreloadDidFinishNotification object:nil];
 

yutamic

macrumors newbie
Original poster
Jan 13, 2009
8
0
Thank you very much jnic!
This solved my problem!!
Now I can finally upload my app without any bug:)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.