2

I´m trying to play a file located on network at address:

string filePath = @"\\192.168.xx.xx\folder\folder2\Audio\audio.wav";

and trying to play it in MediaPlayer.MediaPlayer player like this:

m_player = new MediaPlayer();
m_player.Stop();
m_player.Open(new Uri(path));
m_player.Play();

It doesn't return any exception, but it also does not play the sound. When I copy the file on a local disk and try to play it, it works fine.

Any ideas where the problem could be?

Tim Kathete Stadler
  • 1,067
  • 4
  • 26
  • 52
Wally_the_Walrus
  • 219
  • 1
  • 5
  • 17

2 Answers2

1

Doing some Google says, that you should try a relative Uri.

m_player = new MediaPlayer();
m_player.Stop();
m_player.Open(new Uri(path, UriKind.Relative));
m_player.Play();

Otherwise have a look at this example, which opens a stream and sets the stream to the MediaPlayer.

Matthias
  • 5,574
  • 8
  • 61
  • 121
0

The SoundPlayer class can do this. It looks like all you have to do is set its Stream property to the stream, then call Play.

Chazt3n
  • 1,641
  • 3
  • 17
  • 42