Your setup seems to be correct, but i guess that the MediaElement
cannot find the minotaurFoot.mp3
. Register the MediaFailed
-Event of the MediaElement
and check if it gets raised. The ExceptionRoutedEventArgs
passed to the method, should contain information about, why the file cannot be played.
XAML
<MediaElement x:Name="footStep"
MediaFailed="MediaFailedHandler"
Source="minotaurFoot.mp3"
Volume="1"
LoadedBehavior="Manual"/>
C#
public void MediaFailedHandler(object sender, ExceptionRoutedEventArgs e){
// e.ErrorException contains information what went wrong when playing your mp3
}
Update
You also need to copy the mp3 to the output folder of you project. This is done by setting Copy always
or Copy if newer
in the Advanced Setting Copy to Output directory
.
Select the mp3 file in your project, right click to open ContextMenu. Then select Properties and make the specified setting above.