Playing Audio in Locking Mode - iphone

I am working on Audio related project. I am playing audio, in both case, either my app is active or suspended. I am stuck here, when I play audio and lock my iphone, when I double click on home button, there appears the player controls. I try to play/pause may audio, without unlocking the iphone same as in default ipone/ipod application. Is it possible? If yes then feel free to help. Thanks in advance.

Use Remote Control events
Remote control events are any event received for the purpose of controlling media. eg iTunes pause/play/next/previous buttons available from double-tapping the home screen button, or remote-control events from play/pause buttons on headphones.
http://www.sagorin.org/2011/11/29/ios-playing-audio-in-background-audio/

Related

How to get AirPlay from UIWebView to continue playback when app is backgrounded *without* setting AVAudioSession category to Playback?

I've been attempting to make this work for quite a while now:
My app has the potential to play videos of Youtube from within UIWebView. The user could want to use AirPlay for this. When AirPlay is on, the device could go to sleep and normally video stops playing moments after that happens. As advised in other posts, I set the AVAudioSession category to the Playback one and it works - AirPlay continues even when the device display goes to sleep.
However, this has a side-effect; if the user has activated the app while music playback is on in the background, setting the app's audio session category to Playback causes the playing music to stop and this is definitely annoying.
Ideally, I want to set the AVAudioSession category when playback of Video starts, not when my App is activated - but I've not seen any central or UIWebview notification / delegate method to determine this.
I've got a hackish workaround for iPhone where the UIWebview hosted video player always loads full screen modal and thus can be determined. But my app is Universal and on iPad the video starts inline; I can't figure out a way to know when Video playback is going to happen. This is exactly the point when the audio category should be switched to Playback - it will actually help users who want background music playing only until video starts up.
I don't want to fool around with adding Javascript events on to Video tags inside the UIWebView - that seems too fragile to me.
Is it possible to observe any AVFoundation notifications that trigger for the UIWebView video playback? Or anyone know of any other way to determine if video playback will start / has started?

Is it possible to pause my flash app on iphone by pressing home button?

I'm quite new to Flash. So here's my problem: I've created my app and it works great. But when I press home button on my iphone, my app minimizes and when I open it from multitasking apps, it simply restarts. Is it possible to freeze or pause the game instead of stop? Thanks!
By default the application should be eligible for the 'freeze-drying' iOS4+ functionality that resumes an app from the last place it left off. That may require a setting to be adjusted in your app descriptor (UIApplicationExitsOnSuspend should be false).
If you simply need to save data when the application is quitting, you can listen for Event.EXITING on the NativeApplication:
NativeApplication.nativeApplication.addEventListener(Event.EXITING, onExit);

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.

getting music player control in lock screen like Pandora app in iphone

iphone Pandora app(in ios-4) supports controlling the audio from the lock screen like play,pause,next and prev.
How to get the music player control action from the lock screen.
can any one give me an idea about getting the actions of these control to native application from lock screen like pandora app.
this miight help
using-lock-screen-for-my-app

iPod controls will exit my application

I would like to allow controlling the iPod on top of my application when the user double taps the home button. I know there are a few apps out there that allow this. Unfortunately my app just quits.
Do I have to set anything to allow this behavior?
Is it possible that my app prevents the iPod app from showing above it because it also plays a sound from time to time?
The double-tap-for-iPod behaviour, if people are using the defaults (most people do) only works to bring up the mini player if music is already playing.
Check out Settings > General > Home. As you can see, there are a variety of things the user can choose to happen on double-click. Below that list of things, there is the option for "iPod controls" - when playing music, show iPod controls. This is what you want, and unfortunately there is no way you can choose to override the default behaviour and show iPod controls when music isn't playing.
There are 2 other options (both for the user, not you unfortunately):
If they turn the screen off, whilst in your app, and then double-click the home button, the mini player will show on screen and then they can play music. They will then still be within your app when they turn on and unlock the screen.
If they have a 3G-S or latest iPod Touch, then holding the home button will bring up the voice command menu, from which they can play music. They will then still be in your app when that menu closes.
Probably not the answer you wanted, but that's iPhone development for you!