play background music while playing video - iphone

I need to know is this: can I build an app that plays music once another video with sound is opened?
For ex. I put music on my ipod inside the iphone and can close it out and it plays anytime I open another app.
However, when I open youtube or any type of site like that and hit a video, the music on my iphone cuts off.
I want an app that allows the music to keep playng.
The design and all other parts of app are going to be simple.
Please advise if this is possible?
Thanks-

This is probably not possible to the extent you would hope for. There is a 10 minute limit for how long you can run your app in the background. So you could go into the app, have your app play music, and when you go to youtube or whatever and it would keep playing for up to 10 minutes. But that's probably not what you're hoping for, so the quick answer is no, you can't.

Related

Add image on lock screen in iOS app, when app is running in background

There are many question on site like
Programatically changing the iOS lock-screen ,
How to set lock screen , wallpaper and Ringtone programmatically in iPhone?
All say that apple will reject if we modify the lock-Screen image.
But I seen it in many apps.
Example Saavn is in AppStore.
In this if a song is playing and device is locked,
It shows the image of the current album on the lock screen.
Please share if anybody know how it can be done.
Thanks.
Music apps can change the lock screen wallpaper because iOS automatically displays the album artwork for the song/podcast/etc that's playing (see MPMusicPlayerController docs). As far as I know, it's not an API that's publicly available to developers.
The "podcaster" app (3rd party not apple) displays an image of the currently playing podcast. Podcast images are stored in the RSS feed and not in each mp3 so the app is dynamically telling the os which image goes with with mp3. Of course you can play "silence" out of the speaker but I don't think this is a clean solution

App's album cover - iPhone

I am making an app that plays audio... with each sound piece playing I want to be able to change the "album cover" on the wallpaper of the phone... For example when you play a song on the iPod app it changes your lock screen wallpaper to an album cover photo... so how do I do this for my app, when audio is playing within my app changing the lock screen wallpaper temporarily to the album cover? Any ideas? I was thinking of playing an audio file that actually has a picture compressed into it as the wallpaper image like some iTunes songs but I know not all do that and they still get images.. hmmm Anyways I know it's possible because I own some apps that do that... Thanks if anyone can come up with anything!
In iOS5+ you can use the MPNowPlayingInfoCenter Class to achieve what you want. On version prior iOS5 this is not possible with public APIs.
More Info can be found in the documentation

iOS - Access output audio from background program

Scenario: My app is running in the background. An iPhone/iPad user launches the iPod app (or Pandora or another program that plays audio) on their device and starts playing music. My app detects that that music is now playing, and records or in some way does things with the current playing audio (like stream it to a server), all while still running in the background.
Is this possible? Can anyone point me in the right direction in the SDK on how to do this?
You can't do this. And that is that.

iPhone App kill my iphone music player?

As soon as I open app it kills my music player. I dont want user to feel such experience. Sometime user don't want to stop their music player while app browsing. For that purpose I will provide explicitly a button in my app which stop music player.
So what function I need to call and where in my App which doesn't stop music player as soon as I launch app without single second delay or any interruption ?
You need to play with AVAudioSession. This Link may help you to achieve that.

Play video's audio track when enter background?

I'm using mpmovieplayer to play video on ios 4, and I want to keep the audio playing when my app enter background, but it doesn't work. I thing it's because video player use GPU to render video on screen and this is not allowed by apple when app enter background.
So, is there any way to do that? There are some apps have this feature, and they seems just use the mpmovieplayer, is it work by detach the video layer of mpmovieplayer?
Thanks for your answer!
You'll need to have separate audio file and video file for this. Play both when you need to play video and just the audio when app gets into background.