Is it possible to get data about currently playing track via AirPlay (iOS, Swift)?
My app does not have any player but it communicates with Bluetooth device that can play music. I can get info about current audio track like this:
let systemPlayer = MPMusicPlayerController.systemMusicPlayer
let nowPlayingInfo = systemPlayer.nowPlayingItem
And then just simply get the data like this:
print("title: \(nowPlayingInfo?.title)")
print("album title: \(nowPlayingInfo?.albumTitle)")
print("album artist: \(nowPlayingInfo?.albumArtist)")
print(" artist: \(nowPlayingInfo?.artist)")
However I can get the audio info only if there is something playing from iTunes (local content). When I play something via AirPlay (for example using Spotify) then all I got is just nil
.
How can I get data for each scenario like iOS get in Control Center?:
Look at the audio info