0

There's not much to my question I guess. I'm just curious about how CocoaLibSpotify works with AVFoundation and if it's compatible with how Apple needs me to register for remote control events and to set the now playing info in MKNowPlayingInfoCenter.

Apple says to receive remote control events my app needs to "Begin playing audio. Your app must be the “Now Playing” app. Restated, even if your app is the first responder and you have turned on event delivery, your app does not receive remote control events until it begins playing audio.'" however, that's all the documentation I can find... Does playing a track with SPPlaybackManager meet this requirement? What is the requirement anyway?

Thanks for your help again.

4

1 回答 1

2

远程控制事件可以在 CocoaLibSpotify 中正常工作,根本不需要对库进行任何修改,但只能在设备上而不是在模拟器中(包括 iOS7 的控制中心)。

以简单播放器为例,我做了以下更改:

  • 更改Simple_PlayerAppDelegate为 的子类UIResponder

  • 覆盖canBecomeFirstResponder:返回YES

  • 实施remoteControlReceivedWithEvent:

  • playTrack:对 CocoaLibSpotify 的调用的回调中,添加了:

    [[UIApplication sharedApplication] beginReceivingRemoteControlEvents]; [self becomeFirstResponder];

这些更改允许 Simple Player 在设备上运行时接收远程控制事件。

于 2013-10-02T09:30:47.107 回答