I am writing a Windows Phone 8.1 App (WINRT).
I want a 1 second tick sound to get played when user clicks on a button. I tried using MediaElement, but the problem is it pauses the MediaPlayer song. I even tried to change AudioCategory /Stream type but its not helping.
For example, while using whatsapp,messenger,etc, if a sound comes from app, it does not pause our xbox music. How to achieve this?
private void CreateMediaElements()
{
//WINRT:
MediaElementObject = new MediaElement();
MediaElementObject.AudioCategory = AudioCategory.Alerts;
MediaElementObject.IsLooping = false;
MediaElementObject.Source = new Uri("ms-appx:///Audio/General/Alerts/ExitCloseAlert_01.wav", UriKind.RelativeOrAbsolute);
MediaElementObject.Height = 0;
MediaElementObject.Width = 0;
MediaElementObject.AutoPlay = false;
LoginPageMainGrid.Children.Add(MediaElementObject);
}