Stream audio to several client

  • (2 Pages)
  • +
  • 1
  • 2

18 Replies - 976 Views - Last Post: 05 March 2013 - 08:15 AM Rate Topic: -----

#1 pepsy11  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 28
  • Joined: 11-October 10

Stream audio to several client

Posted 25 February 2013 - 02:49 AM

Hi
I am making a website using ASP.NET and i have a webservice using WCF.

I need to figure out how i can stream audio(.mp3 files most likely) to several clients, so that all the clients hear the same, at the same time. I know this can be done using sockets, but I need a lot of different streams(which is not so good with sockets as i would need a new port to every stream, as far as know). It is a kind of online radio-ish. Several channels, and users can then listen to the one they want.

Can anyone help me or point me in the right direction for something like this? It does not have to be through WCF, I just need to figure out some way to do this

Is This A Good Question/Topic? 0
  • +

Replies To: Stream audio to several client

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8381
  • View blog
  • Posts: 31,154
  • Joined: 12-June 08

Re: Stream audio to several client

Posted 25 February 2013 - 07:29 AM

Not really an 'advanced topic'.. moving to gen-pop help.
Was This Post Helpful? 0
  • +
  • -

#3 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3172
  • View blog
  • Posts: 9,611
  • Joined: 05-May 12

Re: Stream audio to several client

Posted 25 February 2013 - 02:10 PM

How did you come to the conclusion that sockets is not a good solution?

What scale are you trying to read in terms of number of simultaneous clients? Web servers and game servers handle large numbers of simultaneous clients and they use sockets.
Was This Post Helpful? 0
  • +
  • -

#4 pepsy11  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 28
  • Joined: 11-October 10

Re: Stream audio to several client

Posted 27 February 2013 - 04:56 PM

View PostSkydiver, on 25 February 2013 - 02:10 PM, said:

How did you come to the conclusion that sockets is not a good solution?

What scale are you trying to read in terms of number of simultaneous clients? Web servers and game servers handle large numbers of simultaneous clients and they use sockets.


Well.. I need to run an unknown amount of channels, all with different sound output, so it is not a very clean choice to choose sockets, as i would need a new port number for each different sound output/channel, right?

This post has been edited by pepsy11: 27 February 2013 - 05:06 PM

Was This Post Helpful? 0
  • +
  • -

#5 pepsy11  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 28
  • Joined: 11-October 10

Re: Stream audio to several client

Posted 28 February 2013 - 04:03 PM

View Postmodi123_1, on 25 February 2013 - 07:29 AM, said:

Not really an 'advanced topic'.. moving to gen-pop help.

What is advanced? I can't get any solution to this problem, and this is not the only place i have been.
So what is the definition of advanced?

This post has been edited by pepsy11: 28 February 2013 - 04:03 PM

Was This Post Helpful? 0
  • +
  • -

#6 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3172
  • View blog
  • Posts: 9,611
  • Joined: 05-May 12

Re: Stream audio to several client

Posted 28 February 2013 - 07:36 PM

View Postpepsy11, on 27 February 2013 - 06:56 PM, said:

View PostSkydiver, on 25 February 2013 - 02:10 PM, said:

How did you come to the conclusion that sockets is not a good solution?

What scale are you trying to read in terms of number of simultaneous clients? Web servers and game servers handle large numbers of simultaneous clients and they use sockets.


Well.. I need to run an unknown amount of channels, all with different sound output, so it is not a very clean choice to choose sockets, as i would need a new port number for each different sound output/channel, right?


I must be missing something... what's wrong with having a new port number for each different sound output/channel?
Was This Post Helpful? 1
  • +
  • -

#7 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3172
  • View blog
  • Posts: 9,611
  • Joined: 05-May 12

Re: Stream audio to several client

Posted 28 February 2013 - 07:41 PM

Consider that one of the protocols which is considered an industry standard uses TCP which uses sockets.
http://en.wikipedia....saging_Protocol

This post has been edited by Skydiver: 28 February 2013 - 07:42 PM

Was This Post Helpful? 0
  • +
  • -

#8 pepsy11  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 28
  • Joined: 11-October 10

Re: Stream audio to several client

Posted 01 March 2013 - 04:44 AM

View PostSkydiver, on 28 February 2013 - 07:36 PM, said:

View Postpepsy11, on 27 February 2013 - 06:56 PM, said:

View PostSkydiver, on 25 February 2013 - 02:10 PM, said:

How did you come to the conclusion that sockets is not a good solution?

What scale are you trying to read in terms of number of simultaneous clients? Web servers and game servers handle large numbers of simultaneous clients and they use sockets.


Well.. I need to run an unknown amount of channels, all with different sound output, so it is not a very clean choice to choose sockets, as i would need a new port number for each different sound output/channel, right?


I must be missing something... what's wrong with having a new port number for each different sound output/channel?


Well.. I might be wrong..
But isn't it a bad design to use a new socket for every output? In case of 1000 different outputs, it would use over 1000 port numbers? It might just be me who think of it as a bad design and weak solution to the problem..

This post has been edited by pepsy11: 01 March 2013 - 04:46 AM

Was This Post Helpful? 0
  • +
  • -

#9 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3172
  • View blog
  • Posts: 9,611
  • Joined: 05-May 12

Re: Stream audio to several client

Posted 01 March 2013 - 07:32 AM

Oh, I see what you are getting at. It's not a matter of whether it will work or not, but whether it looks good or not.
Was This Post Helpful? 1
  • +
  • -

#10 pepsy11  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 28
  • Joined: 11-October 10

Re: Stream audio to several client

Posted 02 March 2013 - 07:53 AM

View PostSkydiver, on 01 March 2013 - 07:32 AM, said:

Oh, I see what you are getting at. It's not a matter of whether it will work or not, but whether it looks good or not.


Haha.. Thank you.. That is exactly the kind of comment we needed to get going.. =b
Was This Post Helpful? 0
  • +
  • -

#11 pepsy11  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 28
  • Joined: 11-October 10

Re: Stream audio to several client

Posted 05 March 2013 - 04:46 AM

Damn. I have so many questions regarding this.. I just can't seem to figure out a solution..

First, how would i stream the same audio fluently to several clients at the same time? With sockets it seems that i would have to stream the .mp3 to one client, then the next, then the next and so on?

Second, how can i play the sound in asp.net? And can i even play .mp3 in asp.net using sockets?

Does anyone know any open source radio-website project?
Was This Post Helpful? 0
  • +
  • -

#12 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3172
  • View blog
  • Posts: 9,611
  • Joined: 05-May 12

Re: Stream audio to several client

Posted 05 March 2013 - 05:51 AM

For your first question, you can write either run multiple threads or write chunks out asynchronously. I would recommend writing out chunks asynchronously.

For your second question, why would you want to play the the sound in ASP.NET? I think it would be better to send the compressed encoded data, and let the clients do the decompression and decoding. This saves on the raw number of bytes you have to send on the wire, which allows service more clients.
Was This Post Helpful? 1
  • +
  • -

#13 pepsy11  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 28
  • Joined: 11-October 10

Re: Stream audio to several client

Posted 05 March 2013 - 06:00 AM

View PostSkydiver, on 05 March 2013 - 05:51 AM, said:

For your first question, you can write either run multiple threads or write chunks out asynchronously. I would recommend writing out chunks asynchronously.


Ahh.. Thanks.. I'll look into that..

View PostSkydiver, on 05 March 2013 - 05:51 AM, said:

For your second question, why would you want to play the the sound in ASP.NET? I think it would be better to send the compressed encoded data, and let the clients do the decompression and decoding. This saves on the raw number of bytes you have to send on the wire, which allows service more clients.

Well.. I am writing, or my team, is writing a ASP.NET site which should be able to play the bytes which it receives
Was This Post Helpful? 0
  • +
  • -

#14 pepsy11  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 28
  • Joined: 11-October 10

Re: Stream audio to several client

Posted 05 March 2013 - 06:53 AM

View Postpepsy11, on 05 March 2013 - 06:00 AM, said:

View PostSkydiver, on 05 March 2013 - 05:51 AM, said:

For your first question, you can write either run multiple threads or write chunks out asynchronously. I would recommend writing out chunks asynchronously.


Ahh.. Thanks.. I'll look into that..


How would i be able to do this when all the sockets should get the same data? A socket should be able to be created and connected mid-play in a song, and then just hear from that point of the song?
Was This Post Helpful? 0
  • +
  • -

#15 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3172
  • View blog
  • Posts: 9,611
  • Joined: 05-May 12

Re: Stream audio to several client

Posted 05 March 2013 - 07:16 AM

View Postpepsy11, on 05 March 2013 - 08:00 AM, said:

Well.. I am writing, or my team, is writing a ASP.NET site which should be able to play the bytes which it receives

Play it for whom? An ASP.NET web server can be just a box sitting on a rack somewhere with no video or audio. Who would be listening to it? If two or more people upload at the same time, what would be played back?

I think what you are trying to say is that the web site can share data uploaded to it to other clients.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2