iOS: App Home Button Shortcut - ios

Having trouble finding the API for the home screen shortcuts when the home button is clicked. My app plays audio and I want those similar shortcuts to pop up like the do for the iPod to give me the option to stop playback.
Can someone just point me to the reference?

This is a good place to start:
Remote Control Events
From the Apple documentation:
Test that your app is properly receiving and handling remote control
events with the Now Playing Controls. These controls are available on
recent iOS devices that are running iOS 4.0 or later. To access these
controls, press the Home button twice, then flick right along the
bottom of the screen until you find the audio playback controls. These
controls send remote control events to the app that is currently or
was most recently playing audio. The icon to the right of the playback
controls represents the app that is currently receiving the remote
control events.

Related

How can we detect the app was open after tapping the Media Player on iOS?

If this is possible, how can we do that? What methods handle the application opening from the Media Player Command Center?
I know we can handle the playback actions (play, pause, previous, next, etc) in the app.
I'd like to know if it's possible to detect that the app was opened after a user tapped on any area (like the top corner) of the Media Player (as on the screenshot below).

How to integrate a music player in iOS system

How can I integrate a music app in the iOS system that my own custom player can handle actions (play, pause, forward) from the unlock screen and how to integrate that is displayed as player app in the double-click-home-button menu like on this screenshot Spotify does:
EDIT: The application itself is based at the Media Player Framework, but in this documents there isn't any hint how to get the custom player in this 'double-click-home-button' menu.
If you register your application for remote control events, and if you start playing either audio or video, your application will automatically take over these controls. See Apple's documentation for more info. This API is available on iOS 4 and later.
To set the string below the controls ("The Butterfly Defect" in your screenshot), use MPNowPlayingInfoCenter, available on iOS 5 and later.

iOS: background play from the browser?

Some iOS apps like Pandora continue playing audio after the app screen has been exited, and even after the device has been locked.
Is it possible to keep audio playing in this way from a browser tab? In other words, can I code an HTML5 page that plays audio and continues playing even after the iPhone is locked?
Yes, audio playing in a mobile Safari tab will continuously play even when multi-tasking or locking your screen. However, if you save the bookmark to the home screen, open, play audio, and then hop out to multi-task, the audio fades out.
Not possible... the browser displaying your page controls what happens when it is deactivated (sent to the background). HTML5 won't touch the behavior of the underlying browser as it relates to system events, so the only way to control background activity in iOS is to write a native app.

How to play a mp3 stream integrated into iPod on iOS

I have a standard mp3 stream that is delivered through http. I use the approach used in this example project:
https://github.com/mattgallagher/AudioStreamer/
Basically it uses the approach described in Apples "Audio Stream Reference". If I set UIBackgroundModes to audio iOS plays the sound if the app is in the background.
But how can I make the iPod controls in the taskbar work? How can I integrate properly with iPod on iOS?
The controls in the taskbar fire remote-control events (for example like controls that are integrated into the head phones). If you follow the instructions described in Apples documentation Remote Control of Multimedia and set UIBackgroundModes to audio, then everything behaves as expected: If the app is suspended the sound continues to play, you app icon appears in the iPod menu in the taskbar and the buttons trigger events.

iOS Background Audio in a Web App

I am writing a web app that uses HTML5 audio. I want to make sure that the user can move to a different application while still listening to the audio in the background. This works while the web app is still within Safari itself. However, when the user adds the web app to their homescreen and it has been set to allow for fullscreen access (no Safari toolbars), when they leave the app the audio does not continue to play. Does anyone know of any way to have a web app proceed while in the background?
Thanks.
I observe exactly the same thing. It's really puzzling as to why Safari, webkit on iOS I suppose really, handles it differently in the two cases.
I notice one thing that might be a small clue, when running as a home-screen'ed 'app' when you playback the audio the iOS status bar (at least on my ios4.1/iphone4) does NOT show playback indicator (blue triangle). But when using the site directly via Safari (and the sound stays in the backgroun as expected) it DOES show the playback indicator.
I think the only people who can probably answer your question are apple since it's their webkit implementation. If you haven't already I would urge you to take this up on the apple developer message boards.
For others not familiar the 'full screen access' Dan is referring to is a Safari specific meta tag that enables a bookmarked web page to open in safari 'full screen' without the location and menu bars.
While HTML5 is making progress on supporting device native features through HTML 5 APIs (such as accelerometers, etc) having true background audio seems like it hasn't really been spec'ed out yet. By background I mean when the browser is not the application that the user is currently focused on. It was only more recently that iOS even supported application multitasking which is what making the behavior from safari possible but it's a separate thing together to integrate that tightly with the OS'es native audio control features, which is what would need to happen.
This is not possible, at least not currently. You are playing the audio from the browser and when the browser closes the system kills the app, or freezes it, unless it has multi-tasking support(but that isn't allowed for web apps)
In iOS 5 and Android 4.0.3, putting a browser window to background does not stop playback. I am not sure about other versions prior to them.
You can do so with an iPhone 4. On my website, I posted a song with the simple html5 tag and I went on it with the iPhone 4. Played the song, left the app. Song runs in the background and there is even a play button on the top bar like when you listen to music on the iPod app.

Resources