如何启用iPod的控制的背景下,以控制非的iPod音乐在iOS 4的? [英] How to enable iPod controls in the background to control non-iPod music in iOS 4?
问题描述
的什么,我试图完成在 Spotify的 iPhone应用程序的最新版本中实现一个很好的例子(潘多拉似乎具有相同的功能)。
A good example of what I'm trying to accomplish is implemented in the latest version of the Spotify iPhone application for (Pandora seems to have the same feature) .
在Spotify的是在后台,双点击打开多任务坞,其中iPod的控制(播放/暂停,前进等),让控制的Spotify的音乐播放(不是iPod的应用程序)。此外,当iPhone / iPod touch的已被锁定,双攻显示类似播放控件。
When Spotify is in the background, double tapping opens the "multi-task dock", where the ipod controls (play/pause, forward etc) allow to control the music playback of Spotify (not the ipod application). Also, when the iphone/ipod touch is locked, double tapping displays similar playback controls.
如果你不明白我的意思,这里有屏幕截图的文章:
<一href=\"http://www.wired.com/gadgetlab/2010/07/spotify-updated-for-ios4-ready-to-replace-ipod/\">http://www.wired.com/gadgetlab/2010/07/spotify-updated-for-ios4-ready-to-replace-ipod/
If you don't know what I mean, here's an article that has screenshots : http://www.wired.com/gadgetlab/2010/07/spotify-updated-for-ios4-ready-to-replace-ipod/
在我当前的应用程序,音乐是从服务器(使用马特·加拉格尔的AudioStreamer)流。我已经成功地保持音乐在后台播放。现在,我想我的播放链接到多任务码头/锁屏。
In my current application, music is streamed from a server (using Matt Gallagher's AudioStreamer). I've managed to keep the music playing in the background. Now, I'd like to link my playback to the "multi-task dock"/lock screen.
我应该使用 [MPMusicPlayerController iPodMusicPlayer]
?我该如何操作?
Should I be using [MPMusicPlayerController iPodMusicPlayer]
? How should I proceed ?
奖金的问题:如果你能告诉我如何在iPod图标更改为我的应用程序图标中的多任务坞(Spotify的拉那招,以及...),这是对子级真棒
Bonus question : if you can tell me how to change the ipod icon to my application icon in the "multi-task dock" (Spotify pulled that trick as well...), that whould be AWESOME.
任何帮助AP preciated,谢谢。
Any help appreciated, thanks.
推荐答案
问题就解决了。
总之,要启用远程控制的事件,1)使用方法:
In short, to enable remote control event, 1) use :
- (无效)remoteControlReceivedWithEvent:(*的UIEvent)theEvent
和2)把这个就是你的视图控制器:
and 2) put this is your view controller :
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
[self becomeFirstResponder];
}
- (BOOL)canBecomeFirstResponder {
return YES;
}
我要给予信贷资助。他已经分叉的马特·加拉格尔的AudioStreamer使所有的iOS4改进(背景音乐,和工作遥控器)。你可以找到他的消息来源与在github工作样品一起: http://github.com/DigitalDJ/AudioStreamer
关于图标:一旦你使用了 beginReceivingRemoteControlEvents
,图标会自动切换到您的应用程序图标。辉煌!
Regarding the icon : once you use beginReceivingRemoteControlEvents
, the icon automatically switches to your app icon. Brilliant !
这篇关于如何启用iPod的控制的背景下,以控制非的iPod音乐在iOS 4的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!