Chapter: Internet & World Wide Web HOW TO PROGRAM - Rich Internet Application Client Technologies - Microsoft ilverlight and Rich Internet Applications

Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail

Silverlight Streaming

Microsoft provides a service called Silverlight Streaming at silverlight.live.com.

Silverlight Streaming

Microsoft provides a service called Silverlight Streaming at silverlight.live.com. This service currently hosts your Silverlight applications for free, which allows individuals and businesses to share video content online without having to provide and pay for the signif-icant bandwidth that video requires. While in prerelease status, Silverlight Streaming pro-

vides you with “up to 4GB storage and unlimited outbound streaming, and no limit on the number of users that can view those streams.”1 Eventually, Microsoft intends to allow “up to 1 million minutes of free video streaming at 700 Kbps per site per month. Unlimited streaming will also be available for free with advertising, or with payment of a nominal fee for the service for use without advertising.”2 You can easily embed Silverlight applications that are hosted by this service into your web pages.

 

Encoding Your Video with Expression Media Encoder

 

According to dev.live.com/silverlight/, the bit rate of video files included with Sil-verlight applications must not exceed 700 Kbps. To ensure that your video adheres to these requirements, it is recommended that you encode your video using Microsoft Ex-pression Blend Media Encoder. A free trial of Media Encoder is available at  www.microsoft.com/expression/products/download.aspx?key=encoder. Once Media Encoder is installed, open it and select Import... from the File menu. Select the video file you would like to encode (Media Encoder supports many video types) and click Open. If the video is encoded in VC-1 and doesn’t open properly, you may need to install Windows Media Player 11. In the Profile panel of the Settings inspector (Fig. 19.16), you can select the Video and Audio type. For the Movie Viewer example, we encoded the video using VC-1 Streaming Broadband and the audio using the Default Profile. In the Output inspector (Fig. 19.16), you can have Media Encoder save a thumbnail of a frame of your choosing, and have the output include one of 14 prebuilt Silverlight media player templates for your video. To start the encoding process, either select Encode from the File menu, or click the Encode button at the bottom of the Media Content inspector.

 

Uploading an Application to the Silverlight Streaming Service

To use the Silverlight Streaming service, you must go to silverlight.live.com and reg-ister for an account. Once you have an account, log in and select Manage Applications from the navigation links on the left side of the page. This page will show you what applications are currently being hosted on your account, and it also enables you to upload applications.



To upload an application, you must package it into a Zip archive. This archive must contain your XAML, your code-behind file, any media elements you use in the applica-tion, and a manifest.xml file (Fig. 19.17). The manifest.xml file specifies the filename of your XAML file (line 4), width and height (lines 5–6), and more.

 

 

1    <!-- Fig. 19.17: manifest.xml -->

 

2    <!-- Manifest for Movie Viewer on Silverlight Streaming. -->

 

3    <SilverlightApp>

 

4          <source>Page.xaml</source>

 

5          <width>640</width>

 

6          <height>480</height>

 

7          <inplaceInstallPrompt>true</inplaceInstallPrompt>

 

8          <background>#000000</background>

 

9          <framerate>24</framerate>

 

10         <version>1.0</version>

 

11         <isWindowless>false</isWindowless>

 

</SilverlightApp>

 

Fig. 19.17 | Manifest for Movie Viewer on Silverlight Streaming.

 

On the Manage Applications page, click the Upload a Silverlight Application link. You must enter an Application Name and select the Zip archive you wish to upload. If the appli-cation uploads successfully after you click Upload, you will see the Manage Application page for the application. On this page, Microsoft provides instructions for adding the application to an existing web page. First, you must create a new JavaScript file to handle the CreateSilverlight function that adds the Silverlight application inside a div in your HTML. For the div element that you add to your HTML, make sure to set the width and height parameters to the width and height of your application. Figures 19.18 and 19.19 show the HTML and JavaScript needed to embed the Movie Viewer application that is hosted on Silverlight Streaming.

 

1    <?xml version = "1.0" encoding = "utf-8"?>

 

2    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

 

3          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

4              

5    <!-- Fig. 19.18: silverlightStreaming.html -->

 

6    <!-- HTML wrapper for Movie Viewer hosted on Silverlight Streaming -->

 

7    <html xmlns = "http://www.w3.org/1999/xhtml">

 

8          <head>

 

9                 <title>MovieViewer Hosted on Silverlight Streaming</title>

 

10                <script type = "text/javascript"

 

11                      src = "http://agappdom.net/h/silverlight.js"></script>

 

12                <script type = "text/javascript"

 

13                      src = "CreateSilverlight.js"></script>

 

14                <style type = "text/css">

 

15                      .silverlightHost { height: 480px;

16                           width: 640px; }

 

17                </style>

 

18         </head>

 

19         <body>

 

20                <div id = "Wrapper_MovieViewer"

 

21                      style = "width: 640px; height: 480px; overflow: hidden;"></div>

 

22                <script type = "text/javascript">

 

var Wrapper_MovieViewer =

24     document.getElementById( "Wrapper_MovieViewer" );  

25               CreateSilverlight();      

26     </script>

27         </body>

 

28   </html>

 

Fig. 19.18 | HTML wrapper for Movie Viewer hosted on Silverlight Streaming.

 

 

1    // Fig. 19.19: CreateSilverlight.js

 

2    // JavaScript to add the Silverlight object to the Wrapper_MovieViewer div

 

3    function CreateSilverlight()

4    {

 

5          Silverlight.createHostedObjectEx( {

 

6                 source: "streaming:/16645/MovieViewer",

 

7                 parentElement: Wrapper_MovieViewer } );

8    }


 

Fig. 19.19 | JavaScript to add the Silverlight object to Wrapper_MovieViewer div.


Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail


Copyright © 2018-2020 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.