How to create video chat---Silverlight 4----


  • I am very happy that now silverlighit 4 supports webcam and microphone, and all that 'I needed to create a video chat.I tried, it works's fantastic!! So I know little or nothing about streaming especially video chat how it works.... and i would ask please u to give me directions on how to start and maybe if you have any example that you feel good ... thank you very much Naty
    Wednesday, December 02, 2009 9:57 AM

All replies

  • Hi,

    Can you please give me some guide lines(sample code) to do this.



    Saturday, December 12, 2009 1:29 AM
  • hi i dont know how to attach files in this Forum, but u can find all in this link Click here

    Saturday, December 12, 2009 12:01 PM
  • You might want to read my blog post I wrote 3 weeks ago, where I already saved the webcam snapshots to a JPEG: EdgeCam Shots - Saving Silverlight 4 Webcam Snapshots to JPEG. I also provided some ideas for streaming using MJPEG in the blog post.

    Saturday, December 12, 2009 2:47 PM
  • The short answer is that although Microsoft allows us to capture the raw bits from the webcam and microphone, Microsoft sill hasn't provided an encoding or streaming mechanism the way that Flash works. On the encoding side, someone did recently post a port of the voice codec Speex to C#. And various folks have described ways to create a quick-and-dirty motion JPEG codec for encoding the frames coming in from the webcam, though so far as I'm aware, nobody's actually posted any working code for how to do it. However, even once you're past that, you still need to upload these streams to a server somewhere, and that means wrapping it with, say, an RTP/RTSP protocol, or perhaps even RTMP. And nobody's yet posted anything on how to do that. I'm pretty sure that the problem will get addressed in the next couple of months, whether by Microsoft or by the dev community, but until then, you're on your own.
    Saturday, December 12, 2009 3:55 PM
  • Excuse me
    You got to solve video chat solution?
    Video transmission or is the solution?

    If you get a solution can share with me?

    Sunday, December 20, 2009 8:44 PM
  • I am working on this and I didn’t achieve anything.




    Sunday, December 20, 2009 11:21 PM
  •  I am making way using red5.

     Already have h264 live playback from live flv streams.

    Already have a Netscape h264 encoder via javascript.

    Not too much needed to finish this but R-n-D budget to upload the bits to the red5.

    Protocol is already defined.

    Thursday, January 07, 2010 3:36 PM
  • Can you tell us more about the H.264 encoder you're using? I've been working on an MPEG2-style block encoder, but performance is proving to be a real problem, especially (oddly enough) on the decode side. Turns out you take a huge performance hit on the inverse discrete cosine transform. I'd love to use something that wasn't written in managed code . . .
    Thursday, January 07, 2010 4:14 PM
  •  I've installed the x264 codec and have enabled the VFW interface which I load inside a dll and stuffed that into a Mozilla script-able plugin sample.


    Thursday, January 07, 2010 4:21 PM
  •  The source code for the dll is GPL and available here

    Thursday, January 07, 2010 4:41 PM
  • Does someone know something about real video chat with Silverlight 4 ?
    Wednesday, March 03, 2010 7:52 PM
  • Regrettably, I think this thread still represents the state-of-the-art with respect to using Silverlight for video chat. MS doesn't have any plans to release a video encoder or streamer, and so far as I'm aware (I've continue to look) nobody else has made available any source code. I'm working on an encoding/streaming solution, but (regrettably) it's going to end up being proprietary, and even so, it's still very slow and CPU intensive, and is barely usable in terms of quality. The CLR just wasn't designed for this sort of thing.
    Wednesday, March 03, 2010 8:05 PM
  • Recently I searched for some solution and found this - I have contacted with this company and they plan to release some bit in May/June – the full answer: We will provide facilities for audio and video encoding/decoding in SL4. The initial version will provide MPEG-4, H.263v2, AMR and G.711 capabilities. Network protocols will include RTP, RTSP and very likely SIP as well.
    Thursday, March 04, 2010 3:56 AM
  • i just started a new project to create a Silverlight voice video chatting system on my site here:

    Silverlight 4 Voice Chat:

    Silverlight 4 WebCam Conferencing:

    Silverlight 4 Desktop Presenter:

    And also an Article Here  

     Your First Step to the Silverlight Voice/Video Chatting Client/Server

    hope you find it useful

    good luck

    Friday, March 05, 2010 6:45 AM
  • Thanks SocketCoder!,

     Your code gave me a great understanding of combining the camera/mic support of SL4 along with basic transmission over a network.

     I have been playing around with attempting to combining video and audio in the same streaming application using your techniques of streaming video and audio separately. I have gotten it to the point where video transmits fine but audio is excessively choppy and distorted. If only a mic is used, the sound works fine.

    I even have the video stream reaching out to a server app on one machine and the audio out to another server app on another machine and everything connects fine. I thought maybe the audio and video buffer streams were crossing into each other but now that they are going out to different servers, I thought this should work, but no luck.

     Anyway if you or anyone else has any suggestions I would greatly appreciate it. Maybe there is a way to compress both together and transmit?




    Monday, March 22, 2010 11:45 AM
  • Hi, I tried to use the voice call, but I heard about one word on six.. Also a lot of problems with noises. With each codec the same situation. Does it work for you? Somebody could talk using SocketCoder soft?
    Thursday, April 01, 2010 9:13 AM
  • Hello,

     hope you test the new version 0.2 here:  the speex version still has some noise issues but the G.711 is working well it's tested on the internet it's just need (16K-Bytes) ... also a new version is coming soon...

    good luck


    Thursday, April 08, 2010 7:53 AM
  • Hi SocketCoder, I've tried only previous version before. This one really works better. Thanks!
    Monday, April 26, 2010 6:17 AM
  • Socket Coder

     I really am interested in your example you have done but don't understand about the Access Policy Xaml. (I have been tinkering with Silverlight for about a year, but am completely new to Sockets and web stuff.)

     What do I save it as, ie what is the file name? I am guessing I would put this in the root directory of a website, ie in the root directory of But when I am trying to run the examples in my visual studio 2010, where do I put it then?

     Basically, what I am trying to ask is, what do I do to get your example working in Visual Studio 2010 using the local host? How would this differ when I get the program running on a website? Would the listening device have to be constantly running on the server???

    Yours with confusion,



    Sunday, May 09, 2010 4:19 PM
  • Hello, Look at this: Maybe it can help you. This article contains a link to the source code. It contains logic that demonstrates a video conferencing chat. It's only a prove of concept. BTW, this application was written using Silverlight 4 RC. So, probably it will not work with RTM, and you will need to recompile it.
    Sunday, June 13, 2010 8:20 AM
  •  that works well.thx

    Monday, June 14, 2010 3:02 AM
  •  I have read, and I will have a try,thx 4 sharing

    Monday, June 14, 2010 3:05 AM
  • Thanks really excellent article Yes, i just noted that you use UDP multicasting so the app cannot be running on the internet it's just for LAN environment, i started a new project but with using TCP protocol so it's working on the internet...

    Compiled version:

    To get the free source code: 

    Monday, June 14, 2010 3:20 AM
  • Yes, you are completely right. But, if I'm not mistaken, the usage of RAW sockets (and single-cast IP addresses) is denied in SL4. They allowed only broadcasting using UdpAnySourceMulticastClient class. MS allowed to use only multicast addresses, otherwise it can be a security hole.
    Monday, June 14, 2010 4:36 AM
  • I don’t think Microsoft  does not support unicasting with UDP for security issues for example Adobe support it with its RTMFP protocol that based on UDP to reduce the bandwidth cost while streaming video/audio data but in Silverlight we still have two options whether unicasting with TCP (that's need more bandwidth and delay time)  or multicasting with UDP (that is useless for the internet)  really Microsoft  should redesign a custom protocol for Silverlight to support real-time data transfer and to be more secure and reliable like RTMP and RTMFP for adobe.

    Monday, June 14, 2010 12:25 PM
  •  Nice blog! Have a lot of technical information that I needed.

    Thursday, June 17, 2010 1:59 AM

    tHANKS ALOT FOR THE TECH INFO. ALTHOUGH I'm sort of new to this area, i'm trying to invoke ur video chat tcp app using my csharp web app. how do i achieve this?, do i add it to my project or solution before calling the service?, pls i need detailed step by step info. thnx

    Tuesday, July 13, 2010 1:52 PM
  • I'm guessing the wait is over. They just released H.263 for Silverlight a couple of days ago. 

    Friday, July 23, 2010 1:11 AM
  • Who has released H.263 for Silverlight? A link please.


    Wednesday, August 18, 2010 1:19 AM
  • Not sure if this helpful still or not, but I believe that I may have a solution.  Awhile back when I began to start playing around with Silverlight's MediaElement I, like many others, decided to make things way more complicated than was necessary.  So instead of using .asx format playlist as the reference for my Player I used a process using WCF where the user would select a music file and silver light would then ping an application that would then add the reference info to a dynamic playlist, which would  then be read as a static reference by the Silverlight app.  I believe that if you were to do similar, but instead of the "static" dynamic recourse being a playlist being a Video "file" then it should work pretty well. but that is only theory at the moment because I have no evidence of it actually working.  but I hope all goes well.

    Wednesday, November 03, 2010 3:38 PM
  • Looks like I'm a bit late to this party, but I just wanted to add that you can use a combination of TCP and UDP to get an internet video/chat service running. You would rely on TCP for maintaining your connection and subscriptions while you would use UDP as your transport mechanism for the more heavy weight video and audio.

    Sunday, April 10, 2011 2:04 PM
  • Hi,

    For creating a Silverlight chat application I can recommend the Ozeki VoIP SIP SDK. For sample source codes check this:

    The support team is also responsive so you can make your project even faster with the help of them.

    Monday, March 19, 2012 10:06 AM
  • I need to build a web application where one user access the Silverlight page and grants access to camera and mic. They click play or start or something and the camera (Broadcasts) the stream to windows media services on a W2k8 machine.Then other users can view the broadcast by browsing to the Windows Media services mms://<servername>/Live with a webpage with a viewer on it.. I have created all the pieces but don't know how to replace MS Expression Encoder to do the broadcast. I see the Socket to Socket sample in Socket Coder. But that is point to point. I just need to broadcast like Expression Encoder do on whatever port you set it to use.

    Sunday, April 15, 2012 7:09 PM