views:

5001

answers:

3

I am currently writing an application that will allow a user to install some form of an application (maybe a Windows Service) that will open a port on it's PC and given a particular destination on the hard disk, will then be able to stream mp3 files.

I will then have another application that will connect to the server (being the user's pc) and be able to browse the hosted data by connecting to that PC (remotely ofcourse) given the port, and stream mp3 files from the server to the application


I have found some tutorials online but most of them are about File Servers in C# and they download allow you to download a whole file. What I want is to stream an mp3 file so that it starts playing when a certain number of bytes are download (ie, whilst it is being buffered)


How do I go about in accomplishing such a task? What I need to know specifically is how to write this application (that I will turn into a Windows Service later on) that will listen on a specified port a stream files, so that I can then access the files by something of the sort: http://<serverip>:65000/acdc/wholelottarosie.mp3 and hopefully be able to stream that file in a WPF MediaPlayer.


[Update]

I was following this tutorial about building a file server and sending the file from the server to the client. Is what I have to do something of the sort?

[Update]

Currently reading this post: Play Audio from a Stream using C# and I think it looks very promising as to how I can play streamed files; but I still don't know how I can actually stream the files from the server.

+4  A: 

There is no effective difference between streaming and downloading. They're the same thing. Any difference is purely semantic.

If you wanted to, you could "download" an MP3 from any web server and start playing it while you were downloading it. It just requires that you buffer some of the data and start sending it to your decoding and playback routines right away.

Similarly, even so called "streaming" servers can be downloaded. You just have to save the bytes as they are being sent across the wire to a file.

"Streaming" applications are just apps that are not designed to save the files to disk.

EDIT:

There is an exception. Two really. If you are streaming "live" audio, such as radio or other types where you don't need 100% reliability, then they stream using UDP. This can still be saved if you want, but it's more packet oriented than stream oriented.

The second is when encryption is used, in which case you can still probably save the file, but it would be useless with the encryption algorithm and keys.

Mystere Man
You can stream from IIS or use "Cassini" server to write your own. It's not hard to do. Plop them in a folder on the website. Just remember that spaces are either %20 or + in web stuff. like http://server/john%20Cougar%20Mellencamp.mp3 or http://server/john+Cougar+Mellencamp.mp3
Rick Ratayczak
A: 

Hi can u help me out in building the second application(application that will connect to the server (being the client pc) and be able to browse the hosted data by connecting to that PC (remotely server) given the port, and stream mp3 files from the server to the application)

my email address:[email protected] plz help me

with regards,

Govind Gupta

Govind
A: 

I'm facing this problem, can anyone solve it ? Or any project can download a mp3 file from URL and auto play it when finish downloading ? Thank you...

JOhn Miler