ApplicationMusicPlayer.shared.state.objectWillChange publisher emits twice.

I'm developing an app which utilises playback from the Apple Music catalogue using MusicKit. Playback works fine however, whenever the playback state changes the ApplicationMusicPlayer.shared.state.objectWillChange publisher is fired twice. Moreover, with each emit the ApplicationMusicPlayer.shared.state is different.

An example:

  1. Music is playing in my app.
  2. Music is paused. (Through any method of pausing)
  3. The objectWillChange publisher is called twice.
  4. In first call state is .playing
  5. In the second call state is .paused

The same happens if playback is then resumed except the states switch. First, .paused and then .playing.

I'm using Combine's .sink() method. I've checked for accidental duplicate subscriptions but there is only one. Is this the intended behaviour or is this an issue?

I'm running into the exact same issue and am a little disheartened to see no one has answered your question in 4 months.

ApplicationMusicPlayer.shared.state.objectWillChange publisher emits twice.
 
 
Q