How can I access another currently playing audio - actual audio element, but metadata is also welcome. I see that this question has been asked a lot, but with several solutions offered over the years. I understand Apple's philosophy, perhaps not wanting the app to do this. I also understand that such a request probably goes beyond the iOS API. With that said, I really would like some kind of solution.
Logically, I feel that
MPNowPlayingInfoCenter.defaultCenter().nowPlayingInfo
must return information for what is currently being reproduced; however, as others have noted, this value is always nil for playing audio outside of your application. It is noteworthy that popular audio applications did not seem to be able to use the MPNowPlayingInfoCenter class to prevent such sound from being displayed.
When using the default music application, you can use
MPMusicPlayerController.systemMusicPlayer().nowPlayingItem
However, what is a more consistent way to access audio games through the podcast app, Spotify, Pandora, Safari, etc.?
Has anyone found a solution? Are there old Objective-C frameworks that support this functionality?
One approach may be viable if there is some way to access the audio track of the current item. For example, if I could get the path to the currently playing item, I could create an AV object from it:
AVAudioPlayer(contentsOfURL: audioUrl)
So, is there a way to get the audio URL of the current playable item and use it that way?
Is the other approach improved?
If a native solution does not exist, is it possible to combine something for its work? Any tips or ideas are welcome.
Edit: I do not believe that anyone was able to achieve this; however, I think many people would like to. If this has been fixed, please connect it! :)