Introduction to Windows 8 style application development 20 MediaElement

Source: Internet
Author: User

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;

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.