Add a media file to a Silverlight 1.0 project

This page applies to Silverlight 1 projects only

When you add a media file (audio or video) to a Microsoft Silverlight 1.0 project, and then insert it onto the artboard, the file is added in a MediaElement object, and is set to play automatically.

Note

You can use Microsoft Expression Encoder 2 to create a media player and skin it using one of many Silverlight 1.0 templates. The media player includes play, pause, and other control buttons already. You can modify copies of the Silverlight 1.0 templates that come with Expression Encoder 2, or you can open your encoded project in Expression Blend 2 to add more visual elements and features.

Use the following procedure to add a media file to a Silverlight 1.0 project in Expression Blend 2.

To add a media file to a Silverlight 1.0 project

  1. Do one of the following:

    • Under Files in the Projects panel, right-click a media file, and then click Insert. Or, if you want to add the media file as a child element in another element in the document, double-click that element under Objects and Timeline in the Interaction panel to make it the active element, and then insert the media file. Alternatively, you can double-click the media file instead of using the Insert command.

    • Drag a media file from a folder in Microsoft Windows Explorer or your desktop onto the artboard.

    • Select the MediaElement control from the Asset Library Cc374993.0224cabd-5da1-4e01-bddd-4a647401a098(en-us,Expression.10).png, draw a media object onto the artboard, and then under Media in the Properties panel, set the Source property to the name of your media file.

    The video file is added to the artboard, and is set to play automatically.

  2. You might like to set other properties also. For example, you could set the following properties under Media in the Properties panel:

    • Stretch   Specifies how video is stretched to fill the media object. Possible values are None, Uniform, UniformToFill, and Fill. The default is Fill.

    • IsMuted   Specifies whether the sound for the video file is muted. The default value is unchecked (or False).

    • Volume   Specifies the volume of the sound for the video file as a value from 0 to 1, with 1 being the loudest. The default value is 0.5.

    If you want to control the playback of the media file, you can use the procedure that is described in Control the playback of media in a Silverlight project.

See also

Concepts

Control the playback of media in a Silverlight project