Set the Now Playing information and control media playback on the Lock Screen and Control Panel using Xamarin.iOS

If your app needs to play some music, or load music from the user’s music library, and you want to see the media information on the Control Panel (swipe up from bottom) and the Lock Screen and control the playback or your audio from those screens, then I might just have the Xamarin.iOS sample app for you. Available on my github site, LockScreenAudio loads the contents of the music library, grouped by artist, into a list view. Selecting a song from the list view loads all of that artists songs into the player queue and starts playing the selected song in a detail view with album artwork and artist, album, song title, and playback controls. The same information is displayed on the Lock Screen and the Control Panel (no artwork in Control Panel though) plus the app will respond to those playback controls as well, including going back a track which proved to be not as trivial as one might think.

Even if your app is supplying its own audio files, rather than using the user’s media, you can still use this as an example for supplying the Now Playing information and controlling your in-app audio from the iOS Lock Screen and Control Panel.

Please let me know if you find this sample app useful.

Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.