When playing a song with the ios 7 music app the user can use slider to change song position in the lock screen/the control center. Slider is active:
But when playing music in my app user can't do it. Slider isn't active:
How can i enable these feature in my app?
I was looking for the same thing but I don't think this is possible see this post:
How to enable audio scrubber in iOS Lock Screen control panel?
Also popular apps like Spotify and Soundcloud don't have this implemented.
If you are looking for a way to show the current music on the lock screen you need to do the following.
First when you play a new track update the NowPlayingInfo :
To handle events from the Lockscreen, you first need to tell your app to start receiving events from the remote control. I do this in the application didFinishLaunchingWithOptions of my AppDelegate using the following code
Next you need to implement remoteControlReceivedWithEvent method to handle the captured events. In APPDelegate add the following method
}
More info on MPNowPlayingInfoCenter from the apple docs -> https://developer.apple.com/library/ios/documentation/mediaplayer/reference/MPNowPlayingInfoCenter_Class
swift4 You can change track position with help of MPRemoteCommandCenter on iOS 9.1 and higher.
and method
note that you have to do that for every command in
commandCenter
if you want it to be enabledYou can change track position with help of MPRemoteCommandCenter on iOS 9.1 and higher.
and method