Search code examples
c#windows-phone-7windows-phonewindows-phone-7.1background-audio

Preinitialize BackgroundAudioPlayer in WP7?


When I am using the BackgroundAudioPlayer in my Windows Phone 7 application, it takes a lot of time to load the first time I want to play a song. Is there any way of preinitializing the BackgroundAudioPlayer before playing the first track, so that when I start playing, it starts right along? I have googled it, but no luck. I am just using BackgroundAudioPlayer.Instance when I e.g. want to play, pause, stop etc an audiotrack. Is there something other i could do to fix this?


Solution

  • You could just call BackgroundAudioPlayer.Instance.Stop(); in your App constructor and then discard the first occurance of UserAction.Stop in the OnUserAction method in your implementation of AudioPlayerAgent