Media Library

RSS for tag

Access read-only collections of the user’s multimedia content using Media Library.

Media Library Documentation

Posts under Media Library tag

14 Posts
Sort by:
Post not yet marked as solved
0 Replies
73 Views
I'm trying to accomplish creating a new playlist on device that appears in AppleMusic, and adding into the playlist a selection of MP3s within a small IOS app. Now the MP3's are either a stream of bytes, or a flat file already stored on the device (the app itself generates these - they aren't downloaded, they are created in app, and then stored on the local device) in it's local storage space. The idea is that created tracks can show up in a specific play list on the device. Now, there appears to be some conflict as to what framework I need to use. I've found MPMediaPlayer, which appears to allow me to create a playlist using the GetPlaylist call, although the documentation on this seems pretty sparse and there's not a lot of examples I can find on how to use this? It looks like a UUID is passed in, but there is no documentation on what this UUID is or where it comes from? If I want to create a new Playlist, I presume I need to generate a UUID, and then store that locally in order to be able to access that playlist again later, yes? There's an AddItem call which looks like it's how you add a track to a playlist, but there's no documentation on how you generate an entry. The documentation for this function talks about a Product ID, without describing what the product ID is, or where it needs to come from. Is this a GUID? Is it a name/description? Does it have to be unique? I'm assuming this Product ID refers to that which is being added to the playlist, but the documentation is sadly lacking in terms of explaining what the product ID refers to. Is it a media Item, or is that what is created when whatever entity the Product ID is referring to is added to the playlist? I'm assuming I can create a NSURL of the file that is stored that is actually the MP3 sample, but what I do with that in order to actually add it as a playlist entry is unknown. I'm sure there is a mechanism to do this, it's just not clear what that is. There's a lack of understanding or explanation of what the process is here, and some illumination would be helpful.
Posted Last updated
.
Post not yet marked as solved
0 Replies
293 Views
Running in a Mac (Catalyst) target or Apple Silicon (designed for iPad). Just accessing the playbackStoreID from the MPMediaItem shows this error in the console: -[ITMediaItem valueForMPMediaEntityProperty:]: Unhandled MPMediaEntityProperty subscriptionStoreItemAdamID. The value returned is always “”. This works as expected on iOS and iPadOS, returning a valid playbackStoreID. import SwiftUI import MediaPlayer @main struct PSIDDemoApp: App { var body: some Scene { WindowGroup { Text("playbackStoreID demo") .task { let authResult = await MPMediaLibrary.requestAuthorization() if authResult == .authorized { if let item = MPMediaQuery.songs().items?.first { let persistentID = item.persistentID let playbackStoreID = item.playbackStoreID // <--- Here print("Item \(persistentID), \(playbackStoreID)") } } } } } } Xcode 15.1, also tested with Xcode 15.3 beta 2. MacOS Sonoma 14.3.1 FB13607631
Posted
by gbuela.
Last updated
.
Post not yet marked as solved
0 Replies
404 Views
I can't work out how to deal with the dialog presented when an app first tries to access a photo library: This screenshot shows the dialog still presented after the app has quit, which suggests to me that it's a system-level rather than app-level dialog; but the handler for addUIInterruptionMonitor(withDescription:handler:) isn't called (whereas it is for both the "Allow MyApp to use your location?" and "MyApp Would Like to Send You Notifications" dialogs). But nor does it appear to be an app-level dialog under XCUIApplication. How can I handle this dialog in my UI testing? Thanks, Hamish
Posted
by hatfinch.
Last updated
.
Post not yet marked as solved
1 Replies
737 Views
Hi! I'm currently developing an app that can play music stored locally. It was working fine previously, but after updating my device to iOS 17, I started getting error -54 when I try to play the file. I also noticed that when getting the list of files in MPMediaQuery.songs(), I would encounter the following errors: I suspect it might be some issue with file permissions, but I can't figure out what i am missing. I have already checked that MPMediaLibrary.authorizationStatus() is authorized. Does anyone know what the issue might be? Thank you
Posted
by LogicUI.
Last updated
.
Post not yet marked as solved
4 Replies
1.7k Views
Hi I have this piece of code in my app that is supposed to open up a file from Music(old iTunes) app and play. But I get 'Attempted to register account monitor for types client is not authorized to access "com.apple.account.iTunesStore". Any suggests how to fix this. What entitlements do I need to set? Code and error logs are below code-block ``` func showiPOD() {           let mediaPicker: MPMediaPickerController = MPMediaPickerController.self(mediaTypes:MPMediaType.anyAudio)     mediaPicker.delegate = self as MPMediaPickerControllerDelegate     mediaPicker.allowsPickingMultipleItems = false     mediaPicker.showsCloudItems = true //show from iCloud as well.. needs to be tested     self.present(mediaPicker, animated: true, completion: nil)   } 2023-01-24 09:31:22.018992-0800 Smart Practice[526:16253] [Entitlements] MSVEntitlementUtilities - Process Smart Practice PID[526] - Group: (null) - Entitlement: com.apple.accounts.appleaccount.fullaccess - Entitled: NO - Error: (null) 2023-01-24 09:31:22.022520-0800 Smart Practice[526:16253] [core] Attempted to register account monitor for types client is not authorized to access: {(   "com.apple.account.iTunesStore" )} ```language code-block
Posted
by vittalk.
Last updated
.
Post marked as solved
3 Replies
514 Views
Hello everyone, I'm currently in the app soumission process and I struggle to find a valid permission string, specially for the camera access. Could you give me an example of a permission string for camera access that has worked well for you in the app soumission process ? I wish you a good day ! Charles
Posted
by charlw.
Last updated
.
Post not yet marked as solved
0 Replies
483 Views
I have noticed changes Apple Music made to my library, take in particular a changed album edition that is reflected in how the title is listed. I can see the new title in the Music app in two different devices. On one device MPMediaQuery returns the album with the new title. The other device (an iPad with less memory, in case that matters) is still returning the old edition. Is there anything I can do to make sure the data returned is up to date and matches what is seen in the Music app?
Posted
by gbuela.
Last updated
.
Post not yet marked as solved
0 Replies
525 Views
Hi! Is it possible to access metadata information for the personal movie and tv show library? I mean information like the iTunes Store ID, languages, subtitles, has iTunes Extras and maybe even IMDb and TMDB IDs for each title, etc. Is there an API for that like the Apple Music API? I'm no full member of the Apple Developer Program yet, but I'd be very interested if access like with the Apple Music API would also be available for movies and tv shows.
Posted
by JSteinba.
Last updated
.
Post not yet marked as solved
1 Replies
611 Views
**Hey everyone, ** I wanted to share my thoughts and experiences with the iPhone. I've been a proud iPhone user for several years now, and I must say, it has been an incredible journey. The iPhone offers a seamless and intuitive user experience like no other. One of the things I love the most about my iPhone is its exceptional build quality. The sleek design and premium materials make it a joy to hold and use. The retina display is breathtaking, offering vibrant colors and sharpness that truly enhance my multimedia experience. But it's not just about the looks. The performance of the iPhone is unparalleled. From blazing-fast app loading times to smooth multitasking, it handles everything with ease. The A-series chips are powerhouses, ensuring lag-free performance even with resource-intensive tasks. Another standout feature is the App Store. With millions of apps to choose from, I can always find the perfect app to suit my needs. Whether it's for productivity, entertainment, or staying connected with loved ones, there's an app for everything. The camera capabilities of the iPhone are nothing short of remarkable. I'm constantly amazed by the stunning photos and videos I can capture with just a few taps. The advanced camera sensors and image processing algorithms make every shot look professional. The ecosystem integration is where the iPhone truly shines. Seamlessly connecting with my MacBook, iPad, and Apple Watch, I can effortlessly switch between devices and continue my tasks without missing a beat. Features like AirDrop, Handoff, and iCloud syncing make my life so much easier. Security and privacy are also top priorities for me, and the iPhone delivers in these aspects as well. The robust security measures, including Face ID or Touch ID, keep my personal data safe and secure. Overall, the iPhone has become an integral part of my daily life. Its combination of stunning design, powerful performance, remarkable camera, ecosystem integration, and top-notch security make it the ultimate smartphone for me. I couldn't be happier with my choice, and I highly recommend it to anyone looking for an unmatched mobile experience. So, fellow iPhone users, what are your favorite features and experiences? Let's share our love for this incredible device! Cheers, James
Posted Last updated
.
Post not yet marked as solved
0 Replies
620 Views
The following line of code worked fine in macOS 13.3 / Catalyst: try await MPMediaLibrary.default().addItem(withProductID: "1678639572") Since the 13.4 update it now throws an error: The operation couldn’t be completed. (MPErrorDomain error 11.) Although the Apple Music track with catalog Id 1678639572 does seem to get added to the library regardless. MPError.errorCode 11 is an undocumented value. Can someone please advise what error code 11 actually means, and if there's a workaround? I've raised this as feedback id FB12196635.
Posted
by dutton.
Last updated
.
Post not yet marked as solved
2 Replies
1.6k Views
Hi I am working on a music app where I can do some sound analysis, my end goal is to integrate Apple Music API in my app where users can search songs. When the song is played I want to show a type of soundwave/spectrogram. For sound visualization I have AVFoundation but the Music API returns only song ID which could be played using Apple MediaPlayer framework only. Is there any API for doing sound analysis or can I play the Apple music songs using AVFoundation.
Posted
by FJaffri.
Last updated
.
Post not yet marked as solved
8 Replies
2.4k Views
I use addItemWithProductID: in the code below to add an Apple Music track to the user's library. This is mature code that's worked fine previously. But now in iOS 14.0.1 it causes the app to freeze. I can trace when running from Xcode or the released app version from App Store and the app freezes after the line: NSLog(@"just before addItemWithProductID %@", productID); The ">>>added..." line is never called. Any idea as to how to remedy? (void) addAppleMusicTrackWithProductID: (NSString *) productID {         NSLog(@" addApplemUsic has been called for productID: %@", productID);         SKCloudServiceController *cloudServiceController;         cloudServiceController = [[SKCloudServiceController alloc] init];         [cloudServiceController requestCapabilitiesWithCompletionHandler:^(SKCloudServiceCapability capabilities, NSError * _Nullable error){             NSLog(@"capabilities: %lu error:%@", (unsigned long)capabilities, error);             if (capabilities >= SKCloudServiceCapabilityAddToCloudMusicLibrary)             {                 NSLog(@"just before addItemWithProductID %@", productID);                 [[MPMediaLibrary defaultMediaLibrary] addItemWithProductID:productID completionHandler:^(NSArray<__kindof MPMediaEntity *> * _Nonnull entities, NSError * _Nullable error) {                     NSLog(@">>>added %@ with %i entities: %@ and  error %@",productID, (int) entities.count, entities, error);                     NSArray *tracksToPlay = [NSArray arrayWithObject:productID];                     [musicPlayer setQueueWithStoreIDs:tracksToPlay];                     [musicPlayer play];                     NSLog(@">>>>now playing AM title:%@ | artist:%@", musicPlayer.nowPlayingItem.title, musicPlayer.nowPlayingItem.artist);                                      }];             }         }]; }
Posted Last updated
.