views:

699

answers:

2

I need to launch a media file from a URL from within my c# .NET application. Is there any way to do this natively in .NET? I don't need an embedded player, I just need the default player to launch. I have tried

System.Diagnostics.Process.Start("File URL");

but it launches the default browser and downloads the file, instead of attempting to play it in WMP/VLC/whatever the default media player is. Any ideas?

+4  A: 

If you enter an URL it will be handled with the program registered to that URL format, in your case the default web browser.

What format are the media in? You can get associated program for an extension and then run that program with the url as parameter. See: http://stackoverflow.com/questions/24954/windows-list-and-launch-applications-associated-with-an-extension

So if your media is for example .MP3, then find the assoicated program for .MP3 (using the code in the link above) and pass the url as a parameter to that program.

Stefan
+2  A: 

Another way to handle this is to temporary download the file to the local file system and then run your

System.Diagnostics.Process.Start("Local File");

Then it should work as you expect.

Stefan