1

After trying to run a simple audio player, I get this error:

System.UriFormatException: Invalid URI: The format of the URI could not be determined.

Here's my code:

using System;
namespace PurePlayer
{
class MainClass
{
    public static void Main(string[] args)
    {

        System.Media.SoundPlayer player = new System.Media.SoundPlayer("~/Desktop/audio.wav");
        player.Load();
        player.Play();
    }
}
}

Please help me figure out why the audio will not play.

FYI, I am running OSX

  • If you give the fully qualified path like below, is it playing? E.g. System.Media.SoundPlayer player = new System.Media.SoundPlayer("C:/FolderName/audio.wav"); – RK_Aus Apr 28 '17 at 01:32
  • you need a file URI: `"file:///~/Desktop/audio.wav"` – Gusman Apr 28 '17 at 01:50

0 Answers0