Play game background music with iPod music using CocosDenshion - ios

As you can suggest, I have a trouble =)
In the game I use CocosDenshion for playing both background music and sound effects. As far as I know and can see in the code, it uses AVAudioPlayer to play background music. The trouble is appeared when I try to launch my app with music from iPod library.
I set audio category to AmbientSound (tried setting both with AVAudioSession and C interface). If I then try to play game background track directly using AVAudioPlayer, it plays with iPod music in background without problems. But if try to play background music with SimpleAudioEngine, only iPod music is playing.
Can someone give an advice how to make CocosDenshion work in this case?

Related

Play audio in background while built-in music player is active ?

Using the AVAudioSession class, it is possible to play audio in the background, but I was wondering if it is possible to play audio in the background and having the built-in music player playing at the same time. Based on the documentation, this seems to be impossible.
Is there a configuration that I am overlooking or a reliable workaround?

CDAudioManager (cocos2d, ios) how to mix game music and background music so that they play at the same time

I am using CDAudioManager and Cocos2d for my iOs game. I need the iOs player music and game music to play at the same time along with the sound effects. Neither of the modes suits me, since they either shut off the background music or game music.
Here is what I am looking to get:
ipod player music playing, launch game. ipod, game music and effects all play together.
upon resume all the channels should work as they did prior to resume.
ipod player music NOT playing, launch game. game music and effects play. as well as after resume.
kAMM_FxOnly, //!Other apps will be able to play audio
---ipod music plays, game effects play. game music doesn't play.
kAMM_FxPlusMusic, //!Only this app will play audio
---ipod music doesnt play
kAMM_FxPlusMusicIfNoOtherAudio
---ipod music plays, game music doesnt play.
In all of the modes I have tries the ipod music doesn't resume after minimizing.
I'm 99% sure that this is not possible. If the iPod player is playing music, and you play game music it'll stop the iPod player. And vice versa.
I have personally never seen (heard) an app that did this, and the general concern of game developers is more along the lines of not interrupting iPod music if it is playing - meaning how to detect if iPod music is playing in order to prevent the game music from playing and interrupting the iPod music (therefore annoying the user).

How to play background music with MPMusicPlayerController's applicationMusicPlayer in iOS?

Hello i am trying to play background music with MPMusicPlayerController's applicationMusicPlayer in iOS.
I have also added Required background modes in Plist.
But it doesn't play background music.
How can i play background music with MPMusicPlayerController?
Thanks for your reading. :)
The applicationMusicPlayer does not support background music. Use MPMusicPlayerController's iPodMusicPlayer instead. It shares the state with the built-in iPod player and music will continue to play when your app enters the background.
Bryan is right about applicationMusicPlayer not playing music in background, but there is another solution:
You can use AVAudioPlayer to play either streamed or local(bundle) audio. It even allows you to play multiple audio file at the same time having an AVAudioPlayer instance for each.
Here's the documentation:
http://developer.apple.com/library/ios/#DOCUMENTATION/AVFoundation/Reference/AVAudioPlayerClassReference/Reference/Reference.html

iOS 6 AVAudioSession issue

In my application I have made [audioSession setCategory:AVAudioSessionCategoryPlayback] to play audio in back ground and also to mute other audio play backs while playing song in my application. I am playing the audio using AVPlayer and also I have UIWebView for playing video in same Application. The issue arises when I play both video in web view and audio using AVPlayer. The music mixes in this case. Prior to iOS 6 when I rech same situation one audio pauses automatically and the mixing up does not occur. So kindly suggest some solutions.
Try to set
Required background modes -> App plays audio
in Info.plist.

AIR for iOS Sound.play() stops background music

In the game I'm building there are sound effects and music. Players are able to turn off the in-game music and sound effects. I assume that when a player turns off the in-game music it's probably because they want to listen to their own music. However, when I run a Sound.play() in order to play a sound effect the background music being played from the music app is stopped. Is there a way around this?
Thanks in advance.

Resources