6

I've had an app fail in the Marketplace due to my audio MediaElement not accounting for background music. Okay. So I've gone about scouring everything and figuring out how account for this:

  1. Don't set the Source of my WMA in XAML. Load the source in code-behind, snag the MediaOpened event and .Play it there.
  2. While doing #1 above, FrameworkDispatcher.Update, see if MediaPlayer.State = MediaState.Playing and if so, .Pause it and then after the snag to MediaEnded, .Resume it.

This kind of works. Where it doesn't work is in debug mode. Not with the emulator, not with the device, not with WPConnect.exe. What does work is when I disconnect my phone and run background music, launch my app and then click my audio MediaElement. Stopping, resuming the radio is also working like this.

However, what isn't working, is if I have an audio podcast playing in the background and then do my "does work" scenario. It will always stop the audio podcast and never resume it.

Has anyone been able to get around this? Is it a cause of failure for the Marketplace as well (besides just background music)?

P.S. SoundEffect in XNA is NOT an option to be considered for my app.

Todd Main
  • 28,951
  • 11
  • 82
  • 146
  • Do you still have the same problem if you use `MediaPlayer.GameHasControl` to check for background audio? http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.media.mediaplayer.gamehascontrol.aspx – keyboardP Jun 02 '11 at 16:50
  • @ keyboardP: yeah, it will pause the audio podcast, but not resume it using `MediaPlayer.GameHasControl` – Todd Main Jun 02 '11 at 17:14
  • @Otaku - Not an answer, but seems related to the NoDo update http://forums.create.msdn.com/forums/p/83705/504673.aspx#504673 – keyboardP Jun 02 '11 at 17:55
  • @keyboardP: interesting, I thought it was just me. That just may be the issue. Will see if there is a response on the WP7 forum. For now, go ahead and post as an answer because it's the only helpful (and only at all) clue I've gotten about this so far. – Todd Main Jun 02 '11 at 18:27
  • @Otaku - I've posted, but am happy to withdraw as an answer. When you submit your app, you could mention this (with the link) in the Technical Exceptions section and hopefully they'll pass it as a bug in WP7. (Info here: http://create.msdn.com/en-US/home/about/app_submission_walkthrough_upload) – keyboardP Jun 02 '11 at 18:28
  • @Otaku - Haven't tried it, but came across a Music Management class on AppHub, which claims to help with the App Certification. You could see if that class manages to fix the Podcast issue, seeing as it's on the official AppHub site: http://create.msdn.com/en-US/education/catalog/sample/windows_phone_music_manager – keyboardP Jun 02 '11 at 21:04

1 Answers1

3

This seems related to the NoDo update.

keyboardP
  • 68,824
  • 13
  • 156
  • 205