I'm trying to change Source
property of MediaElement
in my windows-phone application , I have two mp3 files in Assets file :
"/Assets/fail.mp3"
"/Assets/success.mp3"
when I set this proeperty in the designer to /Assets/success.mp3"
for example, and invoke :
mediaElement.play();
the sound plays properly , but I want to change the source in my code and then play the sound again , I've tried these options :
mediaElement.Source = new Uri(BaseUri, "/Assets/fail.mp3");
mediaElement.Source = new Uri("ms-appx:///Assets/fail.mp3", UriKind.RelativeOrAbsolute);
mediaElement.Source = new Uri("/Assets/fail.mp3", UriKind.RelativeOrAbsolute);
mediaElement.Source = new Uri("/Assets/fail.mp3");
but none of them works I got no error with no sound !, any one have an Idea what to do ?
mediaelement.Source = new Uri("ms-appx:///Assets/test.mp3");
. It played well. – Xie StevenPlay()
method. It also played successfully. – Xie Steven