Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MediaElement disrupting Audio Podcast (MediaPlayer) in WP7

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.

like image 386
Todd Main Avatar asked May 28 '11 04:05

Todd Main


1 Answers

This seems related to the NoDo update.

like image 145
keyboardP Avatar answered Sep 25 '22 00:09

keyboardP