Section 1: Smooth Streaming Video from Blob Storage

Overview

In this lab, you will build a Silverlight Media Player that plays videos stored in Azure Blob Storage. The player will utilize “Smooth Streaming”, which is the Microsoft HTTP-based adaptive streaming protocol. This approach uses HTTP progressive download to download and play chunks of a video stream.

Objectives

In this lab, you will:

  • Learn to create a Silverlight Media Player.
  • Learn to store videos in Azure Blob Storage.

System Requirements

You must have the following items to complete this lab:

Setup

This lab uses several tools and resources that must be downloaded and installed prior to starting the lab. These resources are:

  • The Big Buck Bunny video
  • Adaptive Streaming with Windows Azure Blobs Uploader
  • Azure Storage Explorer

Download the Big Buck Bunny video from http://mirrorblender.top-ix.org/peach/bigbuckbunny_movies/big_buck_bunny_480p_stereo.avi and save it in a working directory.

Download the Adaptive Streaming with Windows Azure Blobs Uploader (AdaptiveStreamingAzure_binaries.zip). Unzip the files into the same working directory where you placed the Big Buck Bunny video.

Download the Azure Storage Explorer. Run AzureStorageExplorer4.msi to install the tool.

The Windows Azure SDK (included in Windows Azure Tools for Visual Studio) installs a simulation environment on your development machine for testing Azure applications locally before deploying them to the cloud. The simulation environment consists of the development fabric to host web and worker roles, and the development storage which simulates cloud blob, table and queue storage locally.

Development storage uses SQL Server as its underlying storage mechanism, and by default the SDK will attempt to configure it to use SQL Server Express. If you do not have SQL Server Express installed before installing the SDK, or you wish to simply use an existing SQL Server instance to host the development storage database, you must run the dsinit command to select the SQL Server instance where the database will be created.

Please see instructions below for how to run dsinit.

Using dsinit to Configure Development Storage

  1. Open a command prompt.
  2. Edit the following command line as appropriate for your environment, where [AzureSDKInstallDrive] is the drive where you installed the Azure SDK (or Windows Azure Tools for Visual Studio), and [YourSqlInstance] is the SqlServer where you want to create the development storage database.[AzureSDKInstallDrive]\ Program Files\Windows Azure SDK\v1.3\bin\devstore\dsinit.exe /sqlinstance:[YourSqlInstance]Example Command Line:“C:\Program Files\Windows Azure SDK\v1.3\bin\devstore\dsinit.exe” /sqlinstance:.
  3. Note that the sample command line above uses the value “.” for the sqlinstance argument, which specifies that the local default SQL instance will be used for development storage.

Exercises

This Hands-On Lab is comprised of the following exercises:

  1. Smooth Streaming Content
  2. Smooth Steaming in SharePoint 2010

Estimated Time to complete this lab: 30 minutes

Exercise 1: Smooth Streaming Content

In this exercise, you will create the smooth streaming content to upload into Azure. Then you will play the content in a SharePoint 2010 site.

Task 1 – Installing the Expresion Encoder Publishing Plugin

In this task, you will install the Expression Encoder Publishing Plugin for creating the smooth streaming content.

  1. Open a Command Prompt window running as administrator on your machine.
  2. Change the directory to the EncoderPlugin directory associated with the Adaptive Streaming with Windows Azure Blobs Uploader binaries you downloaded during the exercise setup.
  3. Execute install.cmd.

Task 2 – Publishing the Content

In this task, you will create the smooth streaming content and publish it to Azure.

  1. Open Microsoft Expression Encoder 4.
  2. In the Load a New Project screen, click Silverlight Project.
  3. In Expression Encoder 4, click Import.
  4. In the Import Media Files, navigate to the video you downloaded earlier and click Open.
  5. Right click the video and select Apply Preset>Encoding for Silverlight>IIS Smooth Streaming>VC-1 IIS Smooth Streaming - SD 480p VBR.
  6. In the Publish Window, select Windows Azure Adaptive Streaming Publisher from the Publish To drop-down list.
  7. Check the Publish After Encode box.
  8. Enter the Account Name for your Azure account.
  9. Enter the Account Key for your Azure account.
  10. In the Path field, enter smoothstreaming.

    Figure 1

    Publish Settings

  11. Select File>Save Job from the main menu and save the project with the name SmoothStreamingEncoding.
  12. Click Encode.
  13. After the encoding and uploading process is complete, the browser will open with the video running.

Exercise 2: Smooth Streaming in SharePoint 2010

In this exercise, you will play the smooth streaming content in a SharePoint 2010 site.

Task 1 – Playing the Video in SharePoint 2010

In this task, you will play the smooth streaming video in SharePoint 2010.

  1. Run the Azure Storage Explorer you installed as part of the lab set up.
  2. When prompted, add your account information.
  3. Click the Blobs button in the ribbon.
  4. Double click the smoothstreaming folder to display all of the files previously uploaded into Azure.
  5. Double click the MediaPlayerTemplate.xap file to open the Properties window.
  6. Record the Absolute Uri to the package for use in SharePoint 2010 later.
  7. Double click the Manifest file.
  8. Record the Absolute Uri to the Manifest for use in SharePoint 2010 later
  9. Open a SharePoint 2010 site and optionally add a new page for hosting web parts.
  10. Select Site Actions>Edit Page.
  11. Click Insert>Web Part in the ribbon.
  12. In the Media and Content category, select the Silverlight Web Part and click Add.
  13. In the Silverlight Web Part dialog, enter the absolute Uri to the MediaPlayerTemplate.xap file and click OK.
  14. Click Edit Web Part.
  15. Under the Other Settings category, click Custom Initialization Parameters.
  16. Put the following string in this field being careful to enter the absolute Uri for your manifest.

    XML

    playerSettings=<Playlist>
    FakePre-099e1dca800e44bb81ae50ebc4d23c2b-f2cc1c6388e14e53a6c6e2abca6b89deFakePre-d89681ae40eb4baeaafdd25397643369-694c7e40ce344c0a91cfcff624604952FakePre-852ef32ed7fb4097b5d0be9082ca2431-0d281c62a3264bec907886e257d607cfFakePre-b5657322a3db4df9afded0fae5d88ec8-764eca9e92c44d5680c4e633916e2a64FakePre-c8374e53cad24a6886c94dcdd9ea4696-9287e0046ae04cf88337de9988bb6e7bFakePre-929f4c2c58b5437988bf24f4db0298e4-537612bf674643c587ed521a3d75cdc6FakePre-96032079e0464d9b8034f61f5501f3b0-f18f892ff8c94ed89cf2680b8ea2192bFakePre-e00c8ecf5cb94380bea6f1a22df79c4e-6dbd5a1dddc748fe9dc9bb37494a1894FakePre-9c30776f253b4de396e3eea2f0e477a0-f532a816fac04eeba534283cc9b9daeaFakePre-48e98e7ec6f54d30a3706e622ca2a8a3-c9f25dc9b8814c48bbb396bc3650d36cFakePre-8b755fd82b2c482abd2a387ea25bcc25-ca628c3ca87847159909c967efff0aedFakePre-3c3d5b663c524e319da82c0c890bb02d-580661e11cfa46ee88dba429d57b4424FakePre-69d5264d5e3d454fae5cb9ece2f1166d-0ed58035cc1e48c7acee9ef7dcf07d3fFakePre-3f4759b029894226b010814e0fb2374b-91ee666454524cb0a714a302a7c74469FakePre-3257e5e998c6494b847a023d89319f38-27c24970015c4000bc859cc4940620faFakePre-acd33bcdad174205b25f98b801bf15a2-075ecfa5d1044cf9bdadfa7767e77f01FakePre-c1989abb02ac4ae79ca0f4fcc5c23f6d-b949370bb69742a5b5843de7c6073f8dFakePre-f746312001af4d5181df47c3f68f1776-159c461ca263474ba2ea59e91ba6bdc4FakePre-c071cb490361463d8c95626785f8e18f-3cdf038e064447c5b54d8ca31cbe067bFakePre-79d5f0d2d41a485ab9d50e64bd6f1caf-d02413577f094b32989c749dbd603ab0FakePre-9bb239fa9d0b43e5992566f8a25ef7b1-3dd33cfe11d741c2b7eb7cf57760bdceFakePre-6fa3196fa714415b8c59986f9163f18f-bf53de24f93940deaf90c7ed96b3090dFakePre-86cb060927de42d89e693ed420c1e0bd-0e5ca7ae4f2246e995ef86b412ec6045FakePre-76243ed62dd8487aa6eec7661aa587d0-3a55a715db164fa4b7ce2912bcd4aa51FakePre-cc03c8eca3ec40be9aab8009778a7fa8-3cc690490ec1443fb3f1897f7031f1cfFakePre-4081d3fd3225495d836d24db5a8a4575-67d864590d604228a3f22cb13d472766FakePre-16c1e15467a344cfb86a3b9ef242c210-b8b5fb2576c645ebac738a4a1a7a7e90FakePre-a5b46b25247343eab3d96f8876a44fb1-ff75391c66ad420cb52abffe50ce4a1cFakePre-13d985907be8454384b508817b07f75f-241d6b738f9b434796d985800b00bb7e

  17. Click OK and the video should begin to play.

Task 2 – Creating a Time-Limited Uri

In this task, you will create a tme-limited URL for the video so that it can be played for only a specified period of time..

  1. Run the Azure Storage Explorer you installed as part of the lab set up.
  2. Click the Blobs button in the ribbon.
  3. Click the smoothstreaming folder.
  4. Click the Manifest file.
  5. Click the Security button in the ribbon.
  6. In the Blob & Container Security dialog, click the Shared Access Policies tab.
  7. In the Policy Name field type Time Limited.
  8. Check the Read box.
  9. In the Start Time and Expiry Time boxes, enter a time range.

    Figure 2

    Shared Access Policies

  10. Click Save Policies.
  11. Close the Blob & Container Security dialog.
  12. Click the Security button in the ribbon.
  13. In the Blob & Container Security dialog, click the Shared Access Signatures tab.
  14. Make sure the Container Name is set to smoothstreaming and the Blob Name references the Manifest file.
  15. In the Policy drop-down list, select the Time Limited policy.
  16. Click Generate Signature.

    Figure 3

    Shared Access Signatures

  17. Click Copy to Clipboard.
  18. Click the Container Access tab.
  19. Change the Container Access Level to Private.
  20. Click Update Access Level.
  21. Click Close.
  22. Return to the page where the Silverlight Web Part is located and edit the web part properties.
  23. Under the Other Settings category, click Custom Initialization Parameters.
  24. Carefully replace the value of the MediaSource element with the value you copied from the Azure Storage Explorer.
  25. Escape all of the ampersands in the new MediaSource element with &amp; or the resulting XML will be invalid.
  26. Save the changes and play the video.

Summary

In this lab you learned about smooth streaming video. You used community tools to convert a video and save it into Azure blob storage. You then used the available Silverlight web part in SharePoint 2010 to play the video.