質問

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.

役に立ちましたか?

解決

Remote control events work fine with CocoaLibSpotify without any modifications to the library at all, but only on the device and not in the Simulator (including iOS7's Control Center).

Taking the Simple Player example, I made the following changes:

  • Changed Simple_PlayerAppDelegate to be a subclass of UIResponder.

  • Overrode canBecomeFirstResponder: to return YES.

  • Implemented remoteControlReceivedWithEvent:.

  • In the callback to the playTrack: call to CocoaLibSpotify, added:

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

These changes allowed Simple Player to receive remote control events when running on a device.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top