Posts

Post not yet marked as solved
1 Replies
589 Views
Hello, I have a music player application that uses MPMusicPlayerController to play Apple Music songs. Now I want to add a Widget to it that can trigger playback pause on iOS 17. How do I need to achieve this? I can get the playbackStoreID of the song on the Widget Extension and use MPMusicPlayerController setQueue(with:) to play it. How do I pass the playbackStoreID in the Widget to the main application for playback, or should I create a new MPMusicPlayerController on the Widget Extension for playback?
Posted
by tbfungeek.
Last updated
.
Post not yet marked as solved
1 Replies
523 Views
I want use SHLibrary.default.items to show the music i recognized by Shazam. but SHLibrary.default.items always return empty list. I did an experiment and I called SHLibrary.default.items as soon as I entered on a page and it returned an empty list, but after use SHManagedSession to identify songs and then call SHLibrary.default.items it returned the result I wanted. Below is the test code private func bindEvent() { // call when View was create the items return empty if #available(iOS 17, *) { let items = SHLibrary.default.items print("-------->>>>>>>>\(items)") } self.addToMediaLibray.onTap { [weak self] in guard let `self` = self, let result = self.result, let appleMusicID = result.appleMusicID else { return } if #available(iOS 17, *) { // call when music was recognized the item is not empty. let items = SHLibrary.default.items print("1111-------->>>>>>>>\(items)") } } } The attach file is the part of result log My iOS Verion is iOS 17 (21A5326a) XCode Version is 15.0 beta 8 (15A5229m) The result log
Posted
by tbfungeek.
Last updated
.
Post not yet marked as solved
0 Replies
465 Views
I have a song playlist whose element is MPMediaItem, and I want to share this song playlist, so my original plan was to use persistentID as the identification of the song, but I found that persistentID does not seem to be able to cross devices, use MPMediaQuery persistentID to query the result is empty. So my question is? In this case, what should I do to share this playlist, so that other users can find the corresponding song to play after getting the playlist.
Posted
by tbfungeek.
Last updated
.