Appendix E. MediaElement Control

This appendix summarizes the MediaElement control's most useful properties, methods, and events.

Note that many of these properties shown in Table E-1 through E-3 are read-only.

Table E.1. Key Properties of Media

Property

Purpose

Balance

Determines the speaker balance.

BufferingProgress

Returns the percentage of buffering complete.

CanPause

Returns True if the media can be paused.

DownloadProgress

Returns the percentage of download complete.

HasAudio

Returns True if the media has audio.

HasVideo

Returns True if the media has video.

IsBuffering

Returns True if the control is buffering its media.

IsMuted

Returns True if the audio is muted.

LoadedBehavior

Determines what the control does when it is loaded. This can be Manual (control "manually" in code), Play (play when there's valid media), Close (close and release all memory), Pause (prepare to play and then pause), or Stop (prepare to play and then stop).

NaturalDuration

Returns the media's natural duration. This can be a TimeSpan (use the NaturalDuration.HasTimeSpan to see if it has one before using NaturalDuration.TimeSpan), Automatic, or Forever.

NaturalVideoHeight

Returns the video's height.

NaturalVideoWidth

Returns the video's width.

Position

Determines the playback position.

ScrubbingEnabled

Determines whether the control updates itself when a seek is performed while the control is paused.

Source

The media's source

SpeedRatio

Determines the speed ratio. Use a value less than 1 for slow motion or a value greater than 1 for fast ...

Get WPF Programmer's Reference: Windows Presentation Foundation with C# 2010 and .NET 4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.