Using SharePoint Designer and Silverlight to embed Silverlight applications directly into your SharePoint blog posts

We have been looking at ways to increase the discoverability of internally produced video content and rich user experiences developed on Silverlight currently stored in various document libraries throughout our SharePoint intranet/extranet.  One area of particular interest is finding a way to easily incorporate rich user experiences and streaming video directly into individual blog posts taking advantage of the the built-in commenting form provided in the SharePoint blog template. 

One challenge has been finding a "start small" approach to providing the benefits of streaming the video content vs. downloading from document libraries without the need to provision large media servers and associate infrastructure in the short-term.   Another challenge as been finding an approach to surface our rich user experiences developed on Silverlight on our internet-facing site as well as our intranet/extranet environment. 

To address these efforts we recently customized a standard SharePoint blog template using SharePoint Designer to display both streaming video content and Silverlight 2 applications we currently have stored on the Silverlight Streaming Service

The only technical requirements for this solution are that you have access to edit the blog in SharePoint Designer, a free Silverlight Streaming account set-up with your Windows Live Id, and upload at least one video or Silverlight application to the service for use in your blog post. 

 

Blog Home Page

Features: Modified layout, video and/or Silverlight application plays inline, blog title linked to full post page, caption linked to full screen play.

defaultblogpagedetails

Full Post Page

Features: Video or Silverlight application plays inline, full screen link.

bloghomebig

Example short video:

 

Features:

  • Modified layout.
  • Continued ability to post regular blog posts. 
  • Ability to embed videos stored on Silverlight Streaming Service directly into blog posts.
  • Ability to embed your own custom Silverlight applications directly into blog posts.
  • Ability to categorize video posts.
  • Ability to comment on video posts.
  • Makes use of XSLT and CSS for customizations-no custom javascript to deploy or maintain.
  • Ability to add functionality to existing blogs.
  • Ability to further customize via centralized custom XSLT files and custom CSS.
  • Silverlight streaming provides metrics/reporting on downloads, streaming data, etc.  

What is the Silverlight Streaming Service?

Microsoft® Silverlight™ Streaming by Windows Live™ is a companion service for Silverlight that makes it easier for developers and designers to deliver and scale rich media as part of their Silverlight applications. The service offers web designers and developers a free (*) and convenient solution for hosting and streaming cross-platform, cross-browser media experiences and rich interactive applications that run on Windows™ and Mac. Combined with the ability to create content with Microsoft® Expression and other 3rd party tools, web designers and content publishers wishing to integrate Silverlight applications into their online properties can enjoy complete control of the end user experience. 

More details and sign-up free here

Can I use my existing .wmv video files? 

Yes, there are some exceptions and size restrictions but providing you have a valid Windows Live ID account you can upload your .wmv video files directly to the Silverlight Streaming Service using the Manage Videos, Upload Videos feature.  For added features check out Expression Encoder 2 for encoding your videos to specific needs.

Can I use my existing Silverlight 2 .xap files?

Yes, there are some exceptions and size restrictions but providing you have a valid Windows Live ID account you can upload your Silverlight .xap files directly to the Silverlight Streaming Service using the Manage Applications, Upload Applications feature.  For added features check out Expression Blend 2 for designing Silverlight applications without code. 

What SharePoint Designer Customizations  do I need to make to add this functionality to my existing SharePoint blogs?

We added three new site columns on our blog’s post list to allow users to add their own Silverlight Streaming videos and applications and a caption when creating a new post.

    • SilverlightStreamingServiceApplicationUrl (Text Field: Multiple Lines of Text, Plain Text)
    • PostImageCaption (Text Field: Muliple Lines of Text, Rich Text)
    • PostImageUrl (Text Field: Single Line of Text, Plain Text)

 

Download source custom XSLT files and CSS file here

We modified the default.aspx and post.aspx pages to use a customized version of each XSLT that both reformats the layout and incorporates an iframe to display the user-provided SilverlightStreamingApplicationUrl since the default SharePoint editing controls strip out any iframe, embed, or script references.   To accomplish this we first saved back-up versions of our default.aspx and post.aspx pages the opened each in SharePoint Designer in design mode and converted the appropriate dataview web-parts to XSLT (right click, convert to XSLT option)

    • Modifications to Default.aspx
      • Upload the provided default.xsl to the blog’s root folder
      • Convert the post dataview web-part to XSLT
      • Apply the custom XSLT: From the dataview web-part’s Common Data View Properties pane choose DataView Properties, then select the XSLT Source tab and browse to the default.xsl file.
    • Modification to Post.aspx
      • Upload the provided post.xsl to the blog’s root folder
      • Convert the post dataview web-part to XSLT (Ignore @Author error message)
      • Apply the custom XSLT: From the dataview web-part’s Common Data View Properties pane choose DataView Properties, then select the XSLT Source tab and browse to the post.xsl file.
      • Create a filter and parameter to filter the post DVWP by id : From the dataview web-part’s Common Data View Properties pane choose Filter, if not displayed create a new URL parameter for ID and set the value to [id]

We also created a custom version of the blog templates core.css and referenced from the default.aspx and post.aspx pages as a link:

Add custom style sheet reference in default.aspx:

<asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server">

<SharePoint:RssLink runat="server"/>

<link rel="stylesheet" type="text/css" href="customblog.css">

</asp:Content>

Add custom style sheet reference in post.aspx:

<asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server">

<SharePoint:RssLink runat="server"/>

<link rel="stylesheet" type="text/css" href="../../customblog.css">

</asp:Content>

Once my blog is configured how do I create new blog posts that include this new functionaility? 

Simply create you blog post as normal including your post title and post body. 

Then fill in the SilverlightStreamingApplicationUrl and PostImageCaption fields and save your post as normal.  (*see Obtaining the SilverlightStreamingApplicationUrl for details on the URL to use)

 

*Obtaining the SilverlightStreamingApplicationUrl:

From Silverlight Administration Home Upload your .wmv video or Silverlight 2 application to the Silverlight Streaming Service

From Silverlight Administration Home select the link to the video or application.

From Method 1: Embed the video into a web page obtain the embed link for the video or application

SLmanagevideos

 

Important: Copy only the URL inside the iframe (example in red) . 

<iframe src="http://silverlight.services.live.com/invoke/37066/Butterfly%20Sample%20Video/iframe.html" scrolling="no" frameborder="0" style="width:500px; height:375px"></iframe>

 

What’s next?

  • Investigate how to add YouTube and MSN videos into the posts.
  • Simplify deployment for new blogs via site template (.stp file)
  • Create custom site definition with custom columns included.
  • Create SharePoint application page to allow users to upload videos/display in blog post in one step. 
  • Investigate using Silverlight Streaming Services API and existing solutions to provide reporting on #downloads, video streaming data, etc.

 

Thanks,

Rod.