1.后台播放是在Info.plist
的UIBackgroundModes
里加上audio
参考https://developer.apple.com/library/i...
2.“连双击home按钮以后左边的音乐控制栏都变成douban电台的图标了”,这是将自己程序中的某对象注册成相应远程控制消息的响应者。当用户在控制栏点击prev、next、play/pause时,程序会接到相应的消息,接到时你要按照消息对播放做相应控制。
视图控制器中注册响应者:
- (void) viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
[self becomeFirstResponder];
}
- (void) viewWillDisappear:(BOOL)animated {
[[UIApplication sharedApplication] endReceivingRemoteControlEvents];
[self resignFirstResponder];
[super viewWillDisappear:animated];
}
- (BOOL) canBecomeFirstResponder {
return YES;
}
同时视图控制器需实现:
- (void) remoteControlReceivedWithEvent: (UIEvent *) receivedEvent;
3.而让控制栏显式标题又是另外一码事了,你需要在程序中调用媒体中心接口,设置标题和封面。参考http://stackoverflow.com/questions/10...
4.从ID3获取专辑封面和标题是第四码事。。