In window Phone 8.
While Music Player is running I just want to run the game.
On that time Game should show some popup.
Like Background Music process is running do you want to continue or stop.
or else Stop the background music of the game.
How could i do that??
From managed you can use MediaPlayer.GameHasControl from the Microsoft.Xna.Framework.Media.MediaPlayer.GameHasControl library: http://blogs.msdn.com/b/oren/archive/2010/12/02/wp7-dev-tip-detecting-whether-or-not-the-user-is-playing-music-in-the-background.aspx
Related
How can i stop the music/song which is currently playing in background from my app?
When user clicks the stop button in my app it should close/stop the music.
How to implement this functionality.
Thanks...
You should be able to detect if an audio stream is playing: Microsoft.Xna.Framework.Media.MediaPlayer.State
But you can't stop it if it's wasn't launched from you app.
Is it possible to play a piece of audio (very short) in the background agent in Windows Phone? Not background music. What I want to achieve is to tell user what the time is every half an hour.
Try this, it's a tutorial with a sample project:
http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202978%28v=vs.105%29.aspx
I have app that play audio with MediaElement when button is pressed.
But now i have a problem. For example if i play song on mobile and enter the app, when i press that button app breaks and exit...
Now i added at the start page this code:
if (Microsoft.Xna.Framework.Media.MediaPlayer.State == MediaState.Playing)
{
Microsoft.Xna.Framework.Media.MediaPlayer.Pause();
}
And now is the problem that when i start app first time while music i playing, app enter and exit right away, and pause the music. Then if i start app again everything works fine.
But how can i stop or pause the music without exit the app at the first time i start it?
Thanks
UPDATE
I found the answer!
Just add this after Microsoft.Xna.... line in if statment
FrameworkDispatcher.Update();
Now everything works fine.
I stuck in a big problem I am playing audio in background using BackgroundAudioPlayer working fine while I am playing another audio file using MediaElement on foreground the background sound is stopped.I want to play both sound simultaneously background and foreground please let me how it will be done.
MediaElement and BackgroundAudioPlayer are exclusive - you can only use one of these at a time.
You are able to play additional sounds using the XNA SoundEffect APIs however. For example of these APIs see this blog entry.
I am playing continues background music in my app in Windows Phone. From the microsoft certification point of view the parallel sound must not be opened if there is already music being played.
What should I do?
Should I:
Detect any background music like song and prompt to user to stop my app background
OR
Detect any background music and prompt to user to stop already played music in the background like any song?
OR
Can I can play both backgrounds at the same time with the user's permission?
It sounds like options 1 and 2 are just a single choice you can present to the user: "My audio or your existing audio".
However the very fact you start playing audio will very likely stop any background audio. So you must go with option 2.
Who would honestly pick the 3rd option?