MusicKit

RSS for tag

Let users play Apple Music and their local music library from your app using MusicKit.

Posts under MusicKit tag

134 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Seeking Guidance on Creating a Playlist Navigation App with OAuth Authentication
Hello Apple Community, First, I'm asking this on the holidays, so happy holidays. Now I have some "fun coding time" and can do it because I have some holiday time. I'm new to this area and would greatly appreciate your expertise and guidance. Have mercy. I'm attempting to develop a simple application on my Mac OS to browse my playlists. However, I've encountered a few roadblocks that I struggle to navigate. I understand I need to implement two-factor authentication to access my playlists, for which an OAuth setup is required. This involves obtaining an Apple ID and a service ID and dealing with other complex elements. One particular challenge I'm facing is with the redirect URI in the OAuth process. It seems that it needs to be a valid domain, and I'm unsure if using a local server address like https://localhost:5000 would work. My goal is to create a basic Flask application that can interact with Apple's web authentication system, but I'm uncertain about the feasibility of this approach, given the domain restrictions. I would appreciate any advice or step-by-step guidance on the following points. What would be the simplest way to create an application (Swift, Python, or JavaScript) that can authenticate and enable browsing through my playlists? Any insights, tips, or examples you could share would be immensely helpful. I am eager to learn and look forward to your valuable suggestions. Anything step-by-step would be great, but I like to dream. Thank you so much for your time and assistance.
1
0
464
Jan ’24
Need to write a program to embed album art in purchased Apple Music
I recently downloaded Apple Music for for Windows 10 and started a new music library. Then I downloaded all my purchased music albums to my computer. However, the album art is not embedded in any of the m4a files. It is stored in a separate artwork folder. I have Visual Studio 2022 and was wondering how I might go about accessing the Apple Music app using the API. I want the script to go through all my purchased music and take the album art from the artwork folder and embed it in the purchased m4a files. I found some other programs/scripts online but they are all for iTunes or for Mac. None of the old scripts will work because they don’t recognize the new Apple Music for Windows music library. I can’t go back to iTunes because Apple removed all the music options from the iTunes for Windows app. Any ideas on how to get started writing the app/script would be greatly appreciated. Can I download something from Apple to make it easy to access the API in Visual Studio 2022 for Windows?
0
0
347
Dec ’23
SDK or API limitations/timeouts on 'unattended' use of an Apple Music-interface app
Hi, my team is developing an iOS app which connects to Apple Music (currently most of it is via API, but some tests have been done with MusicKit). In a separate development, we were using a service which competes with A.M., and when their (web) API is used, if the user doesn't interact with the app somehow (scrolling, buttons, etc), the connection will timeout after 30 seconds and force them to reconnect. So, questions I have are: Is there any timeout regarding stopping tracks in Apple Music or does the connection to the A.M. app stay active? If the connection drops on iOS as well, is there any limitation regarding streaming A.M. content via API (aka are there licensing issues as well?)
0
0
329
Dec ’23
Tracks from user library play out of order, macOS 14
I am working on an app to play music from the users' library on macOS. I'm not using catalyst btw. Whenever I try to play the track from an album I run into an issue where the track play out of order. I set the queue like this: musicPlayer.queue = ApplicationMusicPlayer.Queue(album: album, startingAt: tracks[index]) Where album is an Album instance that was retrieved through a library request MusicLibraryRequest<MusicKit.Album> And musicPlayer is a reference to ApplicationMusicPlayer.shared When I print out the entries variable the tracks are in the correct order. (I'm using Xcode 15.1 and macOS 14.2) Am I doing something obviously wrong? Or is this a known issue? Thanks in advance, Daan
1
0
321
Dec ’23
mediaPlaybackError callback never fires
Greetings Fellow Humans, My player uses the v3 musickit-js library. I am trying to handle situations where a user tries to play explicit content in my player with an account that has content restrictions enabled. I don't see a mechanism to know if the toggle is set in the account. The only mechanism I see is to respond to a CONTENT_RESTRICTED error as handled by the callback to the function I provide as a callback to the mediaPlaybackError event. I have attached many callbacks (like bufferedProgressDidChange) and those all work, but this one never fires. music.addEventListener("mediaPlaybackError", onPlaybackError); Or music.addEventListener(MusicKit.Events.mediaPlaybackError, onPlaybackError); My onPlaybackError function, at least for debugging purposes, is: function onPlaybackError(e) { console.log("onPlaybackError"); console.log(e); } There are so many error conditions that are meant to be handled in this way but the callback never happens. Am I missing something? Why doesn't this callback fire? Thanks!
1
0
469
Dec ’23
Apple Music API Extended Features - UPDATE/DELETE
Trying to use the Apple Music API for mirroring playlists from spotify. Wondering if it will ever be on the roadmap to update/reorder playlists, or delete playlists/remove items using the API? Is this something that can't be handled or is it a business decision? I see that there is more flexibility with the MusicKit. Can we expect something like this in the future for the API? Thanks,
0
0
498
Dec ’23
Catalyst - Cannot play media with SystemMusicPlayer
Since the latest updates of macOS, probably 14.1, I have not been able to play media using SystemMusicPlayer.shared or MPMusicPlayerController.systemMusicPlayer. ApplicationMusicPlayer still works. This is the error code I am encountering: systemMusicPlayer _establishConnectionIfNeeded failed [application failed to launch] Failed to prepareToPlay with error: Error Domain=MPMusicPlayerControllerErrorDomain Code=10 "Failed to obtain remoteObject [nil server]" UserInfo={NSDebugDescription=Failed to obtain remoteObject [nil server]} Here is a small example to reproduce the bug. MPMusicPlayerController.systemMusicPlayer.setQueue(with: ["1445887715"]) MPMusicPlayerController.systemMusicPlayer.prepareToPlay() Or: extension PlayableMusicItem { // Not working func playWithSystemPlayer() { Task { SystemMusicPlayer.shared.queue = [self] try await SystemMusicPlayer.shared.play() } } // Working func playWithApplicationPlayer() { Task { ApplicationMusicPlayer.shared.queue = [self] try await ApplicationMusicPlayer.shared.play() } } }
2
1
573
Nov ’23
Android Music SDK published to maven
Overview Hi I'm an Android Engineer at Mapbox. We are building SDKs that would include Apple Music integrations. The issue is that we cannot publish an .aar file that includes .aar files. Direct local .aar file dependencies are not supported when building an AAR So the question is, why isn't Apple Music Android SDK published to maven? It's bizarre to download android sdks and then include raw versions in your app anyways. To be specific, the issue is talking about these files. mediaplayback-release-1.1.1.aar musickitauth-release-1.1.2.aar If the artifacts were uploaded to maven, then we could make them part of a build.gradle like this: implementation("com.apple.music.mediaplayback:1.1.1") implementation("com.apple.music.musickitauth:1.1.2") Questions Has someone published these SDKs so we can include them without a raw download? Is there a legal reason to not publish it ourselves?
0
0
344
Nov ’23
Bring Back Gapless Playback
I just ripped a CD onto my Itunes, and when it plays on the CD, it plays gapless as intended, but when ripped and uploaded to my Itunes and Iphone, there is a gap. I hate it. I know previously you could have gapless playback. Can you PLEASE bring it back? It is a simple fix, update your software, and bring back gapless playback please. People have complained about it before, DO something about it.
0
0
435
Nov ’23
Get all local music from iPhone Same Like UIDocumentPicker Without UserInteraction
Hello, I want to fetch all local music files from an iPhone device. I tried MPMediaQuery but I can get only that file which is in the document folder.If we use UIDocumentpicker we can fetch all files from the iPhone (downloads, File Application)after selection by the user. I want to fetch all music files like UIDocumentpicker but without user interaction. Thanks in Advance for your guidance.
0
0
533
Nov ’23
MusicKit / macOS : Song.Artwork not nil when there is no Artwork
I'm using iCloud Music Library. I’m using macOS 14.1 (23B74) and iOS 17.1. i’m using MusicKit to find songs that do not have artwork. On iOS, Song.artwork will be nil for items I know do not have artwork. On macOS, Song.artwork is not nil. However when the songs are shown in Music.app, they do not have Artwork. Is this expected? Alternately, is there a more correct way to determine that a Song has no Artwork? I have also filed FB13315721. Thank you for any tips!
0
0
385
Oct ’23
How to trigger music playback in Widget
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?
1
0
690
Oct ’23
Apple Music Web Kit
Apple Music Kit API will throw an Unauthorized 403 error when I log in successfully using an Apple Music account that has no Apple Music Subscription. After I successfully log in with my credentials, I will see a "Play full songs on the web" screen that indicates a successful log in. When I click "try it now" or "not now," the API will throw a "AUTHORIZATION_ERROR: Unauthorized." Authorization status will be set to 0, preview only will be set to false. Shouldn't the authorization be a success after the user has logged in? Ideally, the status should be a 1and preview true. I think what is missing is the consent screen which shows up only when the user is a subscribed member.
1
0
643
Sep ’23
Play only downloaded tracks in a playlist
When using MusicKit to get a playlist MusicLibraryRequest<Playlist>() with includeOnlyDownloadedContent and then getting the selected playlist's entries via playlist.with([.entries], preferredSource: .library), the entries include all of the items in the playlist, not the downloaded items. Does this mean I need to make another MusicLibraryRequest call (or set of calls, for large playlists) to get only the downloaded tracks in the playlist instead of loading the entries via .with(...)?
0
0
397
Sep ’23
BUG IN APPLE MUSIC
I've been using Apple Music for months, but the problem is that there's a major bug in the "play next" button when i bring a track to the top from the Queue. Kindly resolve the issue. Could someone please tell me what will I get if the bug that I filed is True? Bug Number: FB13199731. Thanks and Regards, Siddharth Ahuja.
1
0
317
Sep ’23