I am working on a SwiftUI iOS app that plays a live radio stream using AVPlayer. I would like to visualize the soundwave of the live radio stream and have it pulsate to the rhythm of music played in the stream. I have already implemented the audio stream using AVPlayer as shown below:
let radioPlayer = AVPlayer()
let livestream = AVPlayerItem(url: URL(string: "https://22653.live.streamtheworld.com/RADIO1_128.mp3")!)
radioPlayer.replaceCurrentItem(with: livestream)
radioPlayer.play()
However, I am unsure how to implement the pulsating soundwave visualization. I'm looking at Swift Charts for the implementation, but I'm open to other suggestions, like TimelineView and Core Graphics...
I came across this repo (SwiftChartsAudioVisualizer's AudioProcessing.swift) that almost provides what I need, but it only works with local file using AVAudioEngine and AVAudioFile, not with a live stream. Am I on the right track here?