How to detect the end of playback with the system music player?

Since iOS 12 it has become difficult to detect the end of playback using the system music player.

In earlier iOS versions, the now playing item would be set nil and you would receive a notification that the player stopped.

In iOS 12 and later, nowPlayingItem still contains the current song and the only notification you get is MPMusicPlayerControllerPlaybackStateDidChangeNotification with the playbackState set to MPMusicPlaybackStatePaused.

Pressing pause in my car (or any remote access) generates the same conditions making it difficult to correctly detect the difference.

It would be nice if they added a notification that playback was done (similar to the other players).

Any suggestions?

How to detect the end of playback with the system music player?
 
 
Q