ipod app replacement-in-a-tab? - iphone

With the new media-library capabilities in the 3.0 SDK, I'd like to have a tab in my application to control the music that's playing. Not just pause and play (i'm aware that pressing the home button twice brings up controls for this), but also the ability to browse and queue albums/artists/songs/playlists. Basically a copy of the ipod app functionality.
Any chance someone has already done this and made it freely available?

I'm not aware of any readily available source for you. However, the Media Player Framework Reference is pretty straight-forward, and you should be able to mimic the iPod app pretty easily (sans CoverFlow and other niceties, of course). Good luck!

The Media Player framework gives you very limited access to the iPod music player. For example, you can't know where the currently playing song is in its playlist. If you use the application music player, it stops the currently playing song, and when you quit, it stops playing, but the app music player does give you more control over playlists.
In short, you can't replicate all the features of the iPod app in a tab in the OS 3.0 through 3.1.3, but you can do a good job of the basic features of the pop-up control when you double-click the home button.

Related

Apple watch video playback

Can apple watch capable of video playback? I want to develop an app similar to vine for apple watch. So, user can consume video conveniently from the watch. Is it possible?
I have played with animating multiple images to create a video but it really is a bad approach. Anyone else comes up with any idea?
Update after WWDC 2015:
Good news! Now it's possible!
Link to sample code:
https://developer.apple.com/library/prerelease/watchos/samplecode/WatchKitMoviePlayer/Introduction/Intro.html
Summary:
Now there is a class (WKInterfaceMovie) that allows you to play videos on the watch :)
From the docs:
A WKInterfaceMovie object lets you play back video and audio content
directly from your interface. A movie object displays a poster image
with a play button on top of it. When the user taps the play button,
WatchKit plays the movie in a modal interface.
Class Reference:
https://developer.apple.com/library/prerelease/watchos/documentation/WatchKit/Reference/WKInterfaceMovie_class/index.html
Using the current APIs it might be difficult/impossible.
Still, the camera application on the apple watch is receiving a live stream coming from the camera of the iPhone at a quite good rate.
Most of the apple watch apps are not using only the publicly available APis but it shows that it should be feasible (not talking about the sound here...)
update:
I had missed one feature, there IS an embedded video player with sound on the apple watch... have someone send you a short video has an iMessage and you are able to play it on the watch...

Not include functionality that requires that mode to run persistently (key App plays audio)

I have my v 1.1 of my app (iphone) which has been rejected from Apple.
Reasons for rejection:
2.16
We found that your app uses a background mode but does not include
functionality that requires that mode to run persistently. This
behavior is not in compliance with the App Store Review Guidelines.
We noticed your app declares support for audio in the
UIBackgroundModes key in your Info.plist, but no audible content is
played when the application is in the background. While your intention
may have been to provide this functionality, at the time of review, we
were not able to play background audio for your app.
As indicated in the iOS Application Programming Guide: "This key is
intended for use by applications that provide audible content to the
user while in the background, such as music-player or streaming-audio
applications." Therefore, it would be appropriate to provide audible
content to the user while the app is in the background or remove the
"audio" setting from the UIBackgroundModes key.
In the v 1.0 which has been accepted the required background mode "App audio plays" was already enable.
When I launch one sound of my app the sound is played and I when click on the lock screen the sound continues to be played in background.
In the new version (v1.1) I added the function which detects when I push the button Home of the iPhone. If the button home is pressed so the sound is paused.
When i try on my device it's run correctly and without bug.
So I don't understand exactly what is the problem with my app?
If you're pausing the sound when you hit the home button, then you aren't playing a sound in the background. Either change your app so that it plays sound in the background all the time, or email Apple and explain that your app needs the background functionality so that it can play while the phone is locked.
I'm not sure but you might be able to play the sound during the lock screen without audio background mode. Try removing it and see if your app behaves the same. If it does, then you should remove the key (no reason to have it).
If you use the audio background mode, your app has to play continuous audio (like the Music app, or Downcast for example). Is that what yours does? Or does it just play a sound briefly?
You should be able to play a short sound (< 10 mins) by using beginBackgroundTaskWithExpirationHandler: (I think!)
See below the answer to my Question from Apple :
Jul 31, 2012 10:21 AM. From Apple.
Hello,
Thank you for providing this information. However, in order to ensure that the audio background feature is properly implemented, it would be appropriate to press on the home button once the audio is launched.
For more information on how to implement this feature, please refer to iOS Application Programming Guide
Please make necessary change to resolve this issue.

On iPhone, how do you allow another app to keep running in the background while your app is running?

For example, if I start a song in Pandora and then open Safari to browse the web the Pandora song will keep playing. However, if I start a song in Pandora and then open my app it kills the Pandora song. How do I let Pandora keep playing while my app is running?
You need to tell the iOS system what behavior it should use to integrate the two audio sessions. By default it cancels the background audio when you use audio. But this behavior can be modified as described in the AVAudioSession docs here.
To quote:
Working with Music Players
To play audio from a user’s iPod library along with your own sounds
(as described in iPod Library Access Programming Guide), you must use
a so-called mixable category configuration for your audio session.
There are two, alternative ways to configure an audio session as
mixable:
Use the AVAudioSessionCategoryAmbient (or the equivalent
kAudioSessionCategory_AmbientSound) category—which is always mixable.
Use the mixable category override property
kAudioSessionProperty_OverrideCategoryMixWithOthers, as described in
“Fine-Tuning the Category,” to make an otherwise nonmixable playback
category mixable. Having used one of these options, your sounds will
not interrupt a music player—and neither will a music player’s sounds
interrupt yours.
There are two reasons why your app might "kill" the background app:
It starts to play music of its own
You use too much memory for it to keep playing and the OS closes the background app
There is no special option you need to select; you just need to be a "good citizen."

Using MediaPlayer and AVFoundation Framework simultaniously in XCode

I'm an inexperienced XCode use and programmer in general so keep that in mind. I'm trying to use the microphone on the iPhone while at the same time allowing the user to play audio while using the "iPod music picker", but when the user selects music and plays it the recorder stops working? I have no idea what is going on here? Also, on a side note, how do you implement forward and back iPod buttons?
Thanks so much!
Sounds like this is an Audio Session issue - you're probably in a mode where you can either play or record, but not both at the same time.
Check out the Audio Session Programming Guide which should explain how to configure your session.
AVAudioSessionCategoryPlayAndRecord — Use this category for an application that inputs and outputs audio. The input and output need not occur simultaneously, but can if needed. This is the category to use for audio chat applications.
AVAudioSessionCategoryAmbient - This category allows audio from the iPod, Safari, and other built-in applications to play while your application is playing audio. You could, for example, use this category for an application that provides a virtual musical instrument that a user plays along to iPod audio.

How to allow ipod music to play while my app is running?

I'm using SimpleAudioEngine to play my sounds and I was wondering if there is anyway to check if iPod music is playing when the app is launched. If so, I want it to continue playing. I'm starting to think it may be called the simple engine for a reason as it doesn't allow features like this, where AVAudioEngine does...
Thanks :)
You should check out the official Audio Session Programming Guide and make sure that you are setting the correct session category. You will want to pick the category that allows your audio to mix with the iPod audio.