I use MediaElement to play video in my app, and have a question about it. When i try to start play video in MediaElement, it stops (pauses) music playing in Background. That is a reason of fail my app certicication in App Hub. How to win this?
1
votes
1 Answers
7
votes
You have to ask the user if he wants to stop the music with something like this:
if (MediaPlayer.State == MediaState.Playing)
{
MessageBoxResult Choice;
Choice = MessageBox.Show("Media is currently playing, do you want to stop it ?", "Stop Player", MessageBoxButton.OKCancel);
if (Choice == MessageBoxResult.OK)
{
MediaPlayer.Stop();
FrameworkDispatcher.Update();
}
}