MediaElement Overview
The MediaElement class is typically used to build audio or video files in a Windows 8 style application.
The MediaElement object provides properties and methods for playing video or audio.
Related MediaElement Development Examples can refer to this link: XAML media playback sample and media play to sample.
MediaElement Object Introduction
It is easy to use MediaElement to build the ability to play video files in the application face.
For example:
The MediaElement control is declared in XAML code, and the Source property value is set to the URI of the video.
<mediaelement x:name= "Media" source= "video/azure_tmobile_500k.wmv" width= "the/>"
In C # code, declare the MediaElement control as follows:
MediaElement MediaElement = new MediaElement ();
Mediaelement.name = "MediaElement1";
Mediaelement.width = n;
Mediaelement.source = new Uri ("ms-appx:///video/azure_tmobile_500k.wmv");
THIS.GRID1.CHILDREN.ADD (mediaElement);
The allowed effect diagram is as follows:
When the page is loaded, the MediaElement is played automatically. In general, to prevent the video from playing automatically, set the MediaElement control's AutoPlay property value to False.
MediaElement Common Properties
Common properties for MediaElement objects include:
1) AutoPlay Property: Specifies whether MediaElement automatically starts playing. The default value is true;
2) ismuted Property: Specifies whether the MediaElement is set to mute. The default value is false,true for mute;
3 Stretch properties: How to stretch the video to populate the MediaElement object. The default value is fill, and the other values are none, uniform, uniformtofill;