Two samples from today's MIX talk
Thanks to the folks who attended my talk at MIX 2010 today. As promised, I'm posting the two samples I showed. I'll post an update when the video from my talk is available, so folks who couldn't attend can see it.
I built a Silverlight application that runs on Windows Phone 7. It's a local search application if you're looking for something like pizza near your current location. The application shows how to access the Bing Search API (a SOAP-based service), as well as Google Maps (a REST-based service). Using the two services together makes for a cool mashup in just a few lines of code. I should note that there is a great Bing Maps control you can use in Silverlight, which is much richer than what I offer here... my point was to demonstrate mashing up two different services together.
Please note that you'll need your own Bing AppID to get this to work - you need to enter that in MainPage.xaml.cs.
Download the source here. This sample requires the MIX release of the Windows Phone 7 developer tools.
In this app I built a simple chat application that uses the Silverlight 4 webcam feature, as well as PollingDuplex and NetTcp to do duplex messaging over both HTTP and TCP. The way this works is that a couple of clients can join a chat room and exchange text messages. The first client to join the chatroom will broadcast video and all other clients in the chat room will receive that video stream. The video encoding process is fairly rudimantary: the video is broken down into individual frames, each frame is encoded as JPEG by using the open-source FJCore, sent to the server, relayed to the subscribed clients, and finally played back at the original frame rate.
The interesting point here is that we use HTTP and TCP duplex together for the best performance. Clients inside the enterprise can use TCP-based duplex. Clients outside the enterprise need to use the HTTP-duplex. There is a slight perf hit, however the server and client code stay almost completely unchanged. Disclaimer: this is not a production-ready way to do video chat. If I were to implement this in production, I'm not sure I would use WCF to stream the individual frames, I would probably use the sockets API directly or use UDP multicast. Take this as a cool WCF demo, and not as any sort of guidance on how to do video chat!
The sample will mostly set itself up once you open it up in Visual Studio. You will need to configure IIS to be able to do TCP for Silverlight: check out steps 4-6 in the "Using NetTcpBinding" section of this documentation topic.
Download the code here. This requires the Silverlight 4 RC tooling.
Program Manager, WCF