Learn Windows Phone7 development together (13th. 5 Multimedia Control)

Source: Internet
Author: User

Multimedia controls are the so-called audio and video controls and image controls. In Phone7, there are many differences with silverlight.

1. Image: Image control, used to display local or network images. This control only supports several image formats. If you want to display other image formats, You need to enable encoding and decoding.

<Image x: Name = "image" Source = "Chrysanthemum.jpg" Height = "200" Width = "200"/>

In XAML, you can set the relative path of the image in the Source attribute. In this case, the image must be content and copied to the xap package. Otherwise, the image cannot be displayed.

You can also load images dynamically in the Code:

Image. Source = new BitmapImage (new Uri ("Chrysanthemum.jpg", UriKind. Relative ));

You can also load the network slice, as long as you use an absolute address:

Image1.Source = new BitmapImage (new Uri ("http://ts3.cn.mm.bing.net/images/thumbnail.aspx? Vertex ", UriKind. Absolute ));

 

Image formats supported by Windows phone7:

 

Although the Beta version supports GIF files and can obtain the file content, this control cannot be used for display.

 

2. MediaElement: multimedia playback control. It can play back local and network multimedia, and supports mms:, rtspt:, rtsp: Streaming Media Protocol. This control is very different from windows mobile. The control on mobile is a complete player, but the current control is only a window that can play multimedia, all controls must be implemented by yourself, or even full screen playback.

<MediaElement Grid. row = "1" Height = "649" HorizontalAlignment = "Left" Name = "mediaElement1" verticalignment = "Top" Width = "480" IsMuted = "False" Stretch = "UniformToFill" source = "Medias/Wildlife. wmv "/>

Source: Set the multimedia address to be played (either local or on the network ). If you want to play a file dynamically, you can set it in the program.

MediaElement1.Source = new Uri ("http://mschannel9.vo.msecnd.net/o9/mix/09/wmv/key01.wmv", UriKind. Absolute );

MediaElement1.Source = new Uri ("Medias/Wildlife. wmv", UriKind. Relative );

 

IsMuted: whether to mute.

Stretch: used to set the filling mode of the video Image in the control, similar to the Image control.

AutoPlay: whether to play automatically.

 

 

 

Media formats supported by Windows phone:

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.