0

I read the instructions here about WP7 background audio player agent. I thought there is only 1 Unknown event and 1 Playing event in agent side

However, when I log the event in OnPlayStateChanged of the agent, using

System.Diagnostics.Debug.WriteLine(player.PlayerState.ToString();

I receive 2 Unknown and 3 Playing events when a new track is play

It's weird, why is that?

P/S: I use the code sample on MSDN How to: Play Background Audio for Windows Phone

onmyway133
  • 45,645
  • 31
  • 257
  • 263

1 Answers1

0

Thanks to Peter Torr, I found the reason

Due to the asynchronous nature of media playback, you should use the arguments to the OnPlayStateChanged callback to drive your logic. You shouldn’t need to query the player (that is mostly for the foreground app to display UI).

onmyway133
  • 45,645
  • 31
  • 257
  • 263