Media overview
Microsoft® Expression Blend provides basic capabilities for media files such as images, audio, and video. You can add a media file to your project and then insert it into a document (right-click and Insert) or into an object such as a layout panel. If the media file is an audio or video clip, it can then be controlled by the timeline that was created for it under Objects and Timeline in the Interaction panel.
Images
Expression Blend supports the most common types of image files such as BMP, GIF, ICO, JPEG, PNG, and TIFF. For instructions about how to add an image file to your project, see Add an image, audio, or video file to a project. After you add an image file, you can place it on the artboard by double-clicking the image file name, or by setting the Source property of an existing image control to the name of the image file.
Audio
Expression Blend supports audio file types such AIF, AIFC, AIFF, ASF, AU, MID, MIDI, MP2, MP3, MPA, MPE, RMI, SND, WAV, WMA, WMDall file formats that Windows Media® Player 10 supports. For instructions about how to add a media file to your project, see Insert an audio or video file into the active document.
Video
Expression Blend supports video file types such as ASF, AVI, DVR-MS, IFO, M1V, MPEG, MPG, VOB, WM, and WMVall file formats that Windows Media Player 10 supports. For instructions about how to add a media file to your project, see Insert an audio or video file into the active document.
You will not be able to insert other video file types, though you will be able to add them to your project using a MediaElement control. You can add a MediaElement control from the Asset Library to your document and then modify its Source property to point to the non-recognized media file type, to ensure the video plays within your application at run time.
In order to work with media in Expression Blend, you must have Windows Media Player 10 installed on your computer. You can download Windows Media Player 10 from the Windows Media Web site. |
Controlling media playback
After you insert an audio file or video clip into your document, you can control its playback using the media timeline that was created for it under Objects and Timeline. You can do the following things with a media timeline:
- Modify the properties of a media element selected under Objects and Timeline. You can change properties such as volume, balance, and speed in the Media category of the Properties panel.
- Manually move the timeline by selecting the Selection tool in the toolbox, and then dragging the gray time bar. You can also right-click the gray time bar to select the looping options. For more information, see the topics listed in Animation.
- Copy and paste the media element and then move the various time bars to schedule the sound to occur at different times.
- Configure a control such as a button to start and stop the media timeline. For an example, see Control media using triggers in a timeline.
- Manipulate the media timeline in the code-behind file the same way that you
would manipulate an animation timeline. For information, see the
Storyboards Overview topic on MSDN. The following code is a very simple example in C# to show
the minimal necessary lines of code to start a storyboard.
using System.Windows.Media; using System.Windows.Media.Animation; // In a method... Storyboard audioResourceWav; audioResourceWav = (Storyboard)this.Resources["AudioResource_wav"]; audioResourceWav.Begin(this);