ASP.NET Futures (July 2007): Adding Video or Audio Media to a Web Application
This walkthrough introduces the ASP.NET Media server control, which enables
you to add video and audio to your Web site. Using the Media control,
you can do the following:
- Add media (such as .wmv, .wma, and .mp3 files) and display a player that uses a built-in
skin.
- Customize a built-in skin by exporting it and then editing it.
- Manage media playback with client script.
This walkthrough demonstrates the basic functionality of the control. For details
about the other features, review the additional topics in this Futures release.
Note To run ASP.NET Web pages that contain the Media or Xaml
controls when using features such as the XamlUrl property, managed
code, or dynamic languages, you must set up MIME types in IIS for the following file
name extensions: .xaml, .dll (for using managed code assemblies), and .py
and .jsx (for using dynamic languages). For more information about configuring a Web
site for these controls, see the Readme.htm file in the "Microsoft Silverlight 1.1 SDK Alpha Refresh.zip"
file. This .zip file is part of the Microsoft Silverlight 1.1 SDK Alpha Refresh on the
Silverlight Web site.
This walkthrough assumes Visual Studio 2005, Microsoft ASP.NET AJAX Extensions 1.0 and Microsoft Silverlight 1.0,
but can be applied to Visual Studio Code Name "Orcas" Beta 2 and .NET Framework 3.5.
Prerequisites
To complete the walkthrough, you need the following:
- Microsoft Silverlight 1.0. For download information, visit the
Silverlight download site.
- Microsoft Visual Studio Code Name "Orcas" Beta 2. For download information, visit
the download site.
- The Microsoft ASP.NET AJAX Extensions 1.0 package installed on your computer. For
download information, visit the
Microsoft AJAX Extensions 1.0 Web site.
- The ASP.NET Futures release (July 2007) or later. For download information visit the
ASP.NET Futures (July 2007) download site.
The .msi installer file includes a Visual Studio Content Installer (.vsi) for creating
a blank ASP.NET Futures Web Site in Visual Studio.
- A media file, such as a .wmv file.
Creating an ASP.NET Futures (July 2007) Application
To begin, you will create an ASP.NET Futures (July 2007) Web Site in Visual
Studio. When you use the Visual Studio project template to create a new Web
Site, Visual Studio creates a normal Web site folder structure with the following
additional items:
- A Bin folder that contains the assemblies for the Futures release.
- A Web.config file that is configured for the features in the ASP.NET Futures (July 2007) release.
- A Default.aspx page that contains a
ScriptManager control.
To create a new ASP.NET Futures (July 2007) Web application
in Visual Studio
- In the File menu, click New, and
then click Web Site.
- In the New Web Site dialog box, select the
ASP.NET Futures (July 2007) Web Site template.
- In the Location list, select File System.
- Specify a name, path, and language for the application, and then click
OK.
Adding the Media Control to a Web Page
Next, you will add and configure a Media control in the Web page and use it
to reference a media file that you have on disk.
To add a Media control to the Web page
- In Solution Explorer, double-click the
Default.aspx file to open it
in the designer.
- Switch to Design view.
- From the ASP.NET Futures tab of the toolbox, drag the a
Media control onto the page. Drop
the control below the ScriptManager control.
- On the Media Tasks menu, click Configure skin. The Configure Skin dialog box is displayed.
Make sure that Use a built-in player skin: is selected, select the Professional
skin, and then close the dialog box.
- In the Properties window, set the
MediaUrl property to the location of the media that you want to play.
- Set the
Height and Width properties to values that will enable you to see the media file when it plays (such as 320 x 320).
- Press CTRL+F5 to run the page.
|