简体   繁体   中英

Create own iOS music player and display on lock screen of iPhone

Is it possible in iOS 11 with the new MusicKit API (or any other iOS API) to create a music player and have it displayed on the iPhone's lock screen, like the current Apple Music player? If so, how -- what APIs should be used?

The first - play user's songs on my app and allow control of my app from the lock screen as my app is playing the music.

This is possible, the Music Kit API allows you to access the user's library:

MusicKit on iOS lets users play Apple Music and their local music library natively from your apps and games. When a user provides permission to their Apple Music account, your app can create playlists, add songs to their library, and play any of the millions of songs in the Apple Music catalog. If your app detects that the user is not yet an Apple Music member, you can offer a trial from within your app.

https://developer.apple.com/musickit/

Regarding the controls from the lock screen. That can be done without using that SDK, its simply filling the "MPNowPlayingInfoCenter"

Refer to this one for it: iOS: Displaying currently played track info in LockScreen?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM