After an Album, Playlist, or collection of songs have been added to the ApplicationMusicPlayer queue, clearing the queue can be easily accomplished with:
ApplicationMusicPlayer.shared.queue.entries = []
This transitions the player to a paused state with an empty queue.
After queueing a Station, the same code cannot be used to clear the queue. Instead, it causes the queue to be refilled with a current and next MusicItem from the Station.
What's the correct way to detect that the ApplicationMusicPlayer is in the state where it's being refilled by a Station and clear it? I've tried the following approaches with no luck:
# Reinitialize queue
ApplicationMusicPlayer.shared.queue = ApplicationMusicPlayer.Queue()
# Create empty Queue
let songs: [Song] = []
let emptyQueue = ApplicationMusicPlayer.Queue(for: songs)
ApplicationMusicPlayer.shared.queue = emptyQueue