Posts

Showing posts from March, 2010

Showing MPEG Videos in Silverlight (or, how to hide the Silverlight control using jQuery)

Recently I've had the very interesting opportunity to work on a project which has a Silverlight front-end and a SharePoint back-end.  Silverlight only supports the WMV format for video, so we handle WMV files natively in Silverlight.  But there was a requirement to also allow other formats (MPEG for example).  We decided to try a third-party tool called Clearbox to show MPEGs (and other file formats) using a "lightbox" approach. Clearbox:  http://www.clearbox.hu/index_en.html Lightbox:  http://en.wikipedia.org/wiki/Lightbox_(JavaScript) Essentially, the solution is to pass the desired file's URL to some Javascript code from Silverlight.  But then the problem becomes, a) how do you hide the Silverlight control when you're displaying your video or image in Clearbox and b) how do you bring back the Silverlight control once the user is done viewing the video or image? I was pleased with the trick I came up with and I thought I'd share it. 1. Call a