Wav file not playing in Metro App


  • I have made a simple audio playing app. It works fine when given a .mp3 file to play. However, when i try to play the file at C:\Windows\Media\Windows Ding.wav  no sound is played. The code i used is here:

    function start() {
        var src = "music/beep.wav";	//renamed from 'Windows Ding.wav'
        var audio = new Audio(src);
    Any idea of what could be the issue?

    Thursday, August 16, 2012 9:05 PM

All replies

  • Hi

    This is Supported audio and video formats (Metro style apps).

    Please make sure your Media Stream Formats(Codecs) is supported.


    Friday, August 17, 2012 3:25 AM
  • You cannot use a path like that in your app:  C:\Windows\Media\Windows Ding.wav  

    The user has to pick the file using a file picker if you wish.

    This sample shows picking a video file to play, but you could do the same for an audio file:



    Jeff Sanders (MSFT)

    Friday, August 17, 2012 1:13 PM
  • For this example, I copied 'Windows Ding.wav' to the project folder and renamed it to beep.wav . So in the code given, it would just need to access the file at music/beep.wav . However, it will not play it still. It will successfully play a .mp3 in the same location however.
    Friday, August 17, 2012 5:56 PM
  • I assumed that because this file was located in the windows folder at the time of installing Win8, it would already be supported.
    Friday, August 17, 2012 5:59 PM
  • Hi MP,

    It is supported and it works!

    There are a couple of things you have to do...

    • Using your sample you need to do a few things.
    • Create a folder called 'music' in your project.
    • Right click on the 'music' folder and choose 'add existing' and point to the .wav file you want to use.
    • Ensure that the properties of that file after you have added it show that the 'Package Action' is set to 'Content'

    If you are missing any of this, then it will fail.


    Jeff Sanders (MSFT)

    Monday, August 20, 2012 1:43 PM