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
http://blog.toetapz.com/2010/11/16/how-to-handle-currently-playing-background-music-in-your-application/
http://spacemigas.wordpress.com/2011/04/07/overcoming-windows-phone-7-mediaelement-limitations/
The Marketplace certification requirements 6.5.3 state that:
Applications that Play a Video or Audio Segment
"An application may interrupt the currently playing music to play a non-interactive full motion video or audio segment (e.g. cut-scene or media clip) without asking for user consent. If music was playing prior to the segment, the application must resume music when the segment has completed."
"An application may interrupt the currently playing music to play a non-interactive full motion video or audio segment (e.g. cut-scene or media clip) without asking for user consent. If music was playing prior to the segment, the application must resume music when the segment has completed."
public static class XnaMusicUtil
{
private static bool isRadio;
private static bool hasSaved = false;
public static void SaveCurrentMediaState()
{
hasSaved = false;
isRadio = false;
if (Microsoft.Devices.Radio.FMRadio.Instance.PowerMode ==
Microsoft.Devices.Radio.RadioPowerMode.On ||
Microsoft.Devices.Radio.FMRadio.Instance.SignalStrength > 0.0)
{
isRadio = true;
hasSaved = true;
}
else if (MediaPlayer.State == MediaState.Playing)
{
hasSaved = true;
}
return;
}
public static void RestoreCurrentMediaState()
{
if (hasSaved)
{
if (isRadio)
{
Microsoft.Devices.Radio.FMRadio.Instance.PowerMode =
Microsoft.Devices.Radio.RadioPowerMode.On;
}
else
MediaPlayer.Resume();
hasSaved = false;
}
return;
}
}
No comments:
Post a Comment