Explore the integration of media technologies within your app. Discuss working with audio, video, camera, and other media functionalities.

Post

Replies

Boosts

Views

Activity

iOS 17.1 Features (Credits, Favorite Artist & Playlist Covers)
Hey there, There was so many awesome new changes introduced in iOS 17.1, and we would love to leverage them via the API! Namely: A new endpoint that returns the credits of a song. A way to add an artist to the library of a user. A way to update the cover of a playlist. All these three features are amazing - please let us know if you plan to add them to the API! All the best, Oskar
0
0
357
Nov ’23
MPRemoteCommandCenter likeCommand and dislikeCommand
I'm trying to show likeCommand and dislikeCommand on the Lock Screen of a music player without success. Are they still supported ? Is there any special configuration on the player or the track for them to show? My current code which works for playCommand looks like this MPRemoteCommandCenter.shared().likeCommand.addTarget { [unowned self] _ in if isPlaying { return .success } return .commandFailed }
0
0
574
Oct ’23
RPScreenRecorder: Recording video
Hello everyone. I am trying to make a small utility that, in the context of digital forensics, logs the desktop. The utility is to be started via shell like this : "./nemeapp start path_to_file" and be terminated in "./nemeapp stop". The code I wrote is: import Foundation import ReplayKit let arguments = CommandLine.arguments guard arguments.count == 4 else { print("Utilizzo: nome_script start|stop percorso_file include_audio(true|false)") exit(0) } let command = arguments[1] let filePath = arguments[2] let includeAudio = arguments[3] == "true" switch command { case "start": startScreenRecording(filePath: filePath, includeAudio: includeAudio) case "stop": stopScreenRecording() default: print("Comando non riconosciuto. Utilizzo: nome_script start|stop percorso_file include_audio(true|false)") } func startScreenRecording(filePath: String, includeAudio: Bool) { if RPScreenRecorder.shared().isAvailable { RPScreenRecorder.shared().startRecording(handler: { error in if let unwrappedError = error { print("Errore durante l'avvio della registrazione: \(unwrappedError.localizedDescription)") } else { print("La registrazione dello schermo è stata avviata correttamente. Il file verrà salvato in: \(filePath)") } }) } else { print("La registrazione dello schermo non è disponibile.") } } func stopScreenRecording() { RPScreenRecorder.shared().stopRecording { previewViewController, error in if let unwrappedError = error { print("Errore durante l'arresto della registrazione: \(unwrappedError.localizedDescription)") } else { print("La registrazione dello schermo è stata interrotta correttamente.") } } } Unfortunately, the code returns no error message. Only when I give the stop command does it tell me that the registration never started. I can't even figure out if it is a permissions issue.
0
0
550
Oct ’23
Create Media Player Application guide
I have designed an app for media player, in this app i need to implement live tv, movies and series. so url can be of any type such as .ts formate for live tv, and .mp4, .mov, etc. I am also going to work with m3u. but AVPlayer does not supports all these urls.So can i get some suggestions and solutions for that. what could be the best practice and how to work with all these kind if urls etc.
0
0
487
Oct ’23
WebP image in Asset Catalog?
It appears I can't add a WebP image as an Image Set in an Asset Catalog. Is that correct? As a workaround, I added the WebP image as a Data Set. I'm then loading it as a CGImage with the following code: guard let asset = NSDataAsset(name: imageName), let imageSource = CGImageSourceCreateWithData(asset.data as CFData, nil), let image = CGImageSourceCreateImageAtIndex(imageSource, 0, nil) else { return nil } // Use image Is it fine to store and load WebP images in this way? If not, then what's best practice?
0
0
1.2k
Oct ’23
iOS 17 Problems in getting RGB color from image
I have written and used the code to get the colors from CGImage and it worked fine up to iOS16. However, when I use the same code in iOS17, Red and Blue out of RGB are reversed. Is this a temporary bug in the OS and will it be fixed in the future? Or has the specification changed and will it remain this way after iOS17? Here is my code: let pixelDataByteSize = 4 guard let cfData = image.cgImage?.dataProvider?.data else { return } let pointer:UnsafePointer = CFDataGetBytePtr(cfData) let scale = UIScreen.main.nativeScale let address = ( Int(image.size.width * scale) * Int(image.size.height * scale / 2) + Int(image.size.width * scale / 2) ) * pixelDataByteSize let r = CGFloat(pointer[address]) / 255 let g = CGFloat(pointer[address+1]) / 255 let b = CGFloat(pointer[address+2]) / 255
1
0
728
Oct ’23
Beginner trying to authorize Apple Music API request
I'm a new programmer and I'm trying to work with the Apple Music API as a way to teach myself. So this is probably a dumb question, but I'm using the docs to figure out how to make a request, and I think I have the token all set with the key ID and UNIX time and all that. But I get a 401 Unauthorized back when I send a GET request with it, and I'm having trouble understanding what the docs say about authorization. It says to pass Authorization: Bearer in the header. I'm trying to do that in Insomnia but it must be over my head. I'm guessing there's something obvious that I'm doing wrong, but I'm not sure what. Hoping someone here will take one look at it and be able to tell me. I tried it a few different ways but this is the gist.
2
0
531
Oct ’23
Share Extension - App no longer showing after Xcode/IOS Update
I recently updated to Xcode 15 and IOS 17 and now my Share Extension is no longer appearing. The share extension is meant to take the URL from a song when a user selects share in Apple Music. It was working perfectly before the update, so I'm wondering if I missed something that would cause this error or if this is happening or has happened to anyone else. If so, what's the best way to fix it? Here's my Activation Rule for reference: <dict> <key>NSExtension</key> <dict> <key>NSExtensionAttributes</key> <dict> <key>NSExtensionActivationRule</key> <dict> <key>NSExtensionActivationSupportsWebURLWithMaxCount</key> <integer>1</integer> </dict> </dict> <key>NSExtensionMainStoryboard</key> <string>MainInterface</string> <key>NSExtensionPointIdentifier</key> <string>com.apple.share-services</string> </dict> </dict>
0
0
644
Oct ’23
Crossfade with MPMusicPlayerController.applicationQueuePlayer
Hi. In iOS 17 Apple introduced crossfading for the Music app. In my app I am using MPMusicPlayerController.applicationQueuePlayer and also want to support crossfading. In an early beta of iOS 17 my app crossfaded automatically with the same setting as for the Music app which maybe was a bug. However, I did not find any way to enable crossfade for my app. Does anybody know how to do that? Thanks, Dirk
1
0
832
Aug ’23
Terrible performance when using MusicKit's Artwork with UIKit
I'm building a UIKit app that reads user's Apple Music library and displays it. In MusicKit there is the Artwork structure which I need to use to display artwork images in the app. Since I'm not using SwiftUI I cannot use the ArtworkImage view that is recommended way of displaying those images but the Artwork structure has a method that returns url for the image which can be used to read the image. The way I have it setup is really simple: extension MusicKit.Song { func imageURL(for cgSize: CGSize) -> URL? { return artwork?.url( width: Int(cgSize.width), height: Int(cgSize.height) ) } func localImage(for cgSize: CGSize) -> UIImage? { guard let url = imageURL(for: cgSize), url.scheme == "musicKit", let data = try? Data(contentsOf: url) else { return nil } return .init(data: data) } } Now, everytime I access .artwork property (so a lot of times) the main thread gets blocked and the console output gets bombared with messages like these: 2023-07-26 11:49:47.317195+0200 Plum[998:297199] [Artwork] Failed to create color analysis for artwork: <MPMediaLibraryArtwork: 0x289591590> with error; Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.mediaartworkd.xpc was invalidated: failed at lookup with error 159 - Sandbox restriction." UserInfo={NSDebugDescription=The connection to service named com.apple.mediaartworkd.xpc was invalidated: failed at lookup with error 159 - Sandbox restriction.} 2023-07-26 11:49:47.317262+0200 Plum[998:297199] [Artwork] Failed to create color analysis for artwork: file:///var/mobile/Media/iTunes_Control/iTunes/Artwork/Originals/4b/48d7b8d349d2de858413ae4561b6ba1b294dc7 2023-07-26 11:49:47.323099+0200 Plum[998:297013] [Plum] IIOImageWriteSession:121: cannot create: '/var/mobile/Media/iTunes_Control/iTunes/Artwork/Caches/320x320/4b/48d7b8d349d2de858413ae4561b6ba1b294dc7.sb-f9c7943d-6ciLNp'error = 1 (Operation not permitted) My guess is that the most performance-heavy task here is performing the color analysis for each artwork but IMO the property backgroundColor should not be a stored property if that's the case. I am not planning to use it anywhere and if so it should be a computed async property so it doesn't block the caller. I know I can move the call to a background thread and that fixes the issue of blocking main thread but still the loading times for each artwork are terribly slow and that impacts the UX. SwiftUI's ArtworkImage loads the artworks much quicker and without the errors so there must be a better way to do it.
4
0
1.1k
Jul ’23
Issue with local music files on iOS 17
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
1
1
1.1k
Jul ’23
ApplicationMusicPlayer macOS vs. Catalyst
ApplicationMusicPlayer is available on the Mac! 🎉🎉🎉 Enormous thanks to @JoeKun and the team. I've already gotten my app up and running through Catalyst, and I've successfully played music! I also got some timeouts, but that was happening on my phone a lot that day too, so maybe my local CDN was just having a bad day. I wanted to ask this question in a lab this week, but the timing didn't work out: Do you expect the experience to be the same using ApplicationMusicPlayer on a Catalyst vs a macOS target? I'm hoping to reuse much of my iPad app and go the Catalyst route, but I wanted to double check that the new support wasn't just for macOS.
2
1
629
Jun ’23