Silverlight VideoPlayer for RailsCasts


I am and will be a Microsoft Developer. While working for convenience with other tools, I love strong type languages. I don’t want to ship products because I saved once and hit “s” one more time, so my product will be shipped with that small, human and yet unpardonable error in code.

How many times did you loose your time and effort with PHP in order to find a small mistake like this?

In my pursue on Microsoft tools path I started enjoying the Silverlight technology. Who might not know, Silverlight is a competitor to Flash. By now, on its 4th version, is way above Adobe Flash in almost all areas (I actually worked with Flex and Flash recently, so I really know what I’m talking about):

  • Easy to develop : the C# language is a world class, easy to write in, with good compiler, a lot of resources and a VERY good IDE (try to write code and animations in same time in that Flash IDE and you’ll see what I mean)
  • Supports Full HD (there are examples on the net with 2 or 3 full HD movies playing), while Flash just tries to get HD with lots of CPU used.
  • The model of development is the same for in Browser and Out of Browser – you don’t need to change the tool from Flash to Flex in order to have same product for Desktop and Web.

So I want to really learn, but what example shall I have? My second job as student is to work in Uni-Bonn, developing a Ruby on Rails solution for them. While this is also an interpreted language, the RubyMine IDE makes it possible not to miss a variable or a mistyped string. It doesn’t provide types, but still, it’s a step forward. To improve my Rails skills I use a lot the website of a professional Ruby developer, Ryan Bates. He has a lot of RailsCasts and he adds one each week. But unfortunately, being an Apple user, the movie is encoded as .mov file. I discovered that on the second link, with smaller font, provides also an .m4p link.

So I  started developing a web Silverlight player for its movies. Yeah, I know, the web is full of them, but I wanted to lean this technology and also improve my access to Rails Casts.

I begun with a simple Silverlight project, adding a MediaElement on the canvas and set its Source property to a movie. It immediately started playing – was a nice experience by now. But you need controls for moving along the movie timeline, a list from which to choose your desired movie.

Thus, I started creating two User controls – one for MediaElement controls, and other for retrieving the guy’s rss feed, parse it and display it nicely. While the controls were quite fast to develop, the list took more time. Also because I wanted to learn a little bit of Expression Blend. So I used the Shawn Wildermuth’s Dirty Little Secret #2 and learn deep custom templating for a Listbox.

Putting all together was a breeze, the most time used was for testing the final product.

You can go directly to the Silverlight player and see the result.