Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Getting Started with the Windows Live Tools : Page 4

Windows Live Tools brings a set of Windows Live services right into your Visual Studio development environment.


advertisement
The SilverlightStreamingMediaPlayer Control
The final Windows Live control is the SilverlightStreamingMediaPlayer, which lets you upload videos to your Silverlight Streaming account and play them on your web site by simply dragging-and-dropping them on the control.

At design time, you provide account credentials for your Silverlight Streaming account and then choose the video that your web page should play. After you drag-and-drop this control onto your web page, you can specify the video to be played through the "Select Media File" form. This form is accessible through the control's tasks window or property grid (see Figure 6). You don't need to write code to make a connection to Silverlight Streaming servers or choose videos. All this is encapsulated; all you you need to do is specify the credentials, and choose a video.

 
Figure 6. The SilverlightStreamingMediaPlayer Control: This control lets you include and stream videos on your pages that you've stored in your Silverlight Streaming account.

After you choose the video you want to play, the control saves the video's URL in streaming:// format in the control's MediaSource property. It also saves AccountID and AccountKey values for your Silverlight Streaming account into the Web.Config file's <appSettings> section, as shown below (using example values for the AccountID and AccountKey keys:

<appSettings> <add key="AccountID" value="MyAccount&#133;" /> <add key="AccountKey" value="MyKey&#133;" /> </appSettings>

The control's HTML declaration would look like this:

<live:SilverlightStreamingMediaPlayer ID="SilverlightStreamingMediaPlayer1" runat="server" Height="240px" Width="320px" MediaSource="streaming:/20709/VideoLibrary/Assets/Bear.wmv"> </live:SilverlightStreamingMediaPlayer>

At run time, the control converts streaming:// URLs to HTTP URLs. If you don't want to hard-code the video, you can also set the video URL from client side JavaScript using code similar to the following (note that you need to hook this JavaScript function to an action, such as a button click):



<script type="text/javascript"> //set URL for silverlight //streaming media player function SetMediaUrl() { var objSLSMPlayer = $find("StreamingMediaPlayer1"); objSLSMPlayer.set_mediaSource(" streaming:/20709/VideoLibrary/Assets/Lake.wmv"); } </script>

You can find details about the underlying ASP.NET MediaPlayer here.

The examples and discussion in this article should prove helpful in getting you started with the Windows Live Tools. If you have feedback about Windows Live Tools or how you are going to use it, please leave suggestions to improve the feature set or bug reports here: http://dev.live.com/tools.



Vikas Ahuja has over ten years' experience delivering IT solutions, Vikas lives in Redmond with his wife. He has worked on the Microsoft.com web site, held different positions in quality assurance, and currently handles program management for the Windows Live Developer Platform.
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap