none
Playing .au format files in windows media player RRS feed

  • Question

  • Hi,

    I have a requirement to select .au format files from file explorer and once hit on play, the file should launch windows media player to play the file. Is this possible to do using C# by leveraging console app or so, if yes, can someone please help me with the code.

    Thanks in advance.

    Monday, January 28, 2019 8:42 PM

All replies

  • Hi Devang Mistry,

    We could call Windows media play via  Process Class, the following code for your reference.

    static void Main(string[] args)
    {
    
        string filePath = @"D:\Data\video\video2.au";
    
        Process.Start("wmplayer.exe", filePath);
    
        Console.ReadLine();
    }

    Best regards,

    Zhanglong


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, January 29, 2019 3:27 AM
    Moderator
  • Hi Zhanglong,

    Thanks for the help, unfortunately it does not wok. It just launches a console.

    Tuesday, January 29, 2019 2:21 PM
  • Hi Zhanglong,

    Thanks for the help, unfortunately it does not wok. It just launches a console.

    It should work.

    Did you set a valid filePath ?

    Tuesday, January 29, 2019 2:44 PM
  • Yes, I did but for some reason its not launching Windows media player, just launches the console.
    Tuesday, January 29, 2019 4:17 PM
  • Well I now see what the issue is, my audio file name is as follows: "Orbo Corey 111-Anderson-date 0101-time 426-duration 1007". Once I removed spaces between words in file name then it plays the file, how to make it work if a file name has spaces between words? Any thoughts? Thanks again.
    Tuesday, January 29, 2019 4:43 PM
  • Add quotes around the file name

    like :

    string filePath = "\"E:\\this is a test.au\"";

    Tuesday, January 29, 2019 5:56 PM