Show / Hide Table of Contents

Class MediaElement

Represents an object that contains audio, video, or both.

Inheritance
System.Object
DependencyObject
UIElement
FrameworkElement
MediaElement
Inherited Members
FrameworkElement.MeasureOverride(Size)
FrameworkElement.ArrangeOverride(Size)
FrameworkElement.LayoutUpdated
FrameworkElement.SizeChanged
FrameworkElement.ResourceLookupMode
FrameworkElement.StyleProperty
FrameworkElement.Style
FrameworkElement.DefaultStyleKeyProperty
FrameworkElement.DefaultStyleKey
FrameworkElement.OverridesDefaultStyleProperty
FrameworkElement.OverridesDefaultStyle
FrameworkElement.OnVisualParentChanged(DependencyObject)
FrameworkElement.VisualChildrenCount
FrameworkElement.GetVisualChild(Int32)
FrameworkElement.Parent
FrameworkElement.AddLogicalChild(Object)
FrameworkElement.RemoveLogicalChild(Object)
FrameworkElement.LogicalChildren
FrameworkElement.TemplatedParent
FrameworkElement.Resources
FrameworkElement.IsLoaded
FrameworkElement.OnApplyTemplate()
FrameworkElement.SetBinding(DependencyProperty, BindingBase)
FrameworkElement.SetBinding(DependencyProperty, Binding)
FrameworkElement.GetBindingExpression(DependencyProperty)
FrameworkElement.Cursor
FrameworkElement.CursorProperty
FrameworkElement.ManageIsEnabled(Boolean)
FrameworkElement.FindName(String)
FrameworkElement.Name
FrameworkElement.NameProperty
FrameworkElement.DataContext
FrameworkElement.DataContextProperty
FrameworkElement.DataContextChanged
FrameworkElement.Triggers
FrameworkElement.FlowDirectionProperty
FrameworkElement.FlowDirection
FrameworkElement.LanguageProperty
FrameworkElement.Language
FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs)
FrameworkElement.Tag
FrameworkElement.TagProperty
FrameworkElement.LoadedEvent
FrameworkElement.Loaded
FrameworkElement.Unloaded
FrameworkElement.BindingValidationError
FrameworkElement.ContextMenuProperty
FrameworkElement.ContextMenu
FrameworkElement.ContextMenuOpening
FrameworkElement.ToolTipProperty
FrameworkElement.ToolTip
FrameworkElement.INTERNAL_OnDetachedFromVisualTree()
FrameworkElement.INTERNAL_OnAttachedToVisualTree()
FrameworkElement.Height
FrameworkElement.HeightProperty
FrameworkElement.Width
FrameworkElement.WidthProperty
FrameworkElement.HorizontalAlignment
FrameworkElement.HorizontalAlignmentProperty
FrameworkElement.VerticalAlignment
FrameworkElement.VerticalAlignmentProperty
FrameworkElement.Margin
FrameworkElement.MarginProperty
FrameworkElement.MinHeight
FrameworkElement.MinHeightProperty
FrameworkElement.MinWidth
FrameworkElement.MinWidthProperty
FrameworkElement.MaxHeight
FrameworkElement.MaxHeightProperty
FrameworkElement.MaxWidth
FrameworkElement.MaxWidthProperty
FrameworkElement.ActualWidthProperty
FrameworkElement.ActualWidth
FrameworkElement.ActualHeightProperty
FrameworkElement.ActualHeight
UIElement.TransformToVisual(UIElement)
UIElement.RenderSize
UIElement.DesiredSize
UIElement.InvalidateMeasure()
UIElement.InvalidateArrange()
UIElement.Measure(Size)
UIElement.Arrange(Rect)
UIElement.UpdateLayout()
UIElement.DragEnter
UIElement.DragLeave
UIElement.Drop
UIElement.DragOver
UIElement.CacheMode
UIElement.CacheModeProperty
UIElement.Projection
UIElement.ProjectionProperty
UIElement.VisualParent
UIElement.AddVisualChild(UIElement)
UIElement.RemoveVisualChild(UIElement)
UIElement.OnVisualChildrenChanged(DependencyObject, DependencyObject)
UIElement.XamlSourcePath
UIElement.ClipToBounds
UIElement.ClipToBoundsProperty
UIElement.ClipProperty
UIElement.Clip
UIElement.IsEnabledProperty
UIElement.IsEnabled
UIElement.IsEnabledChanged
UIElement.EffectProperty
UIElement.Effect
UIElement.RenderTransformProperty
UIElement.RenderTransform
UIElement.RenderTransformOriginProperty
UIElement.RenderTransformOrigin
UIElement.UseLayoutRounding
UIElement.UseLayoutRoundingProperty
UIElement.Visibility
UIElement.VisibilityProperty
UIElement.IsVisibleProperty
UIElement.IsVisible
UIElement.IsVisibleChanged
UIElement.OpacityProperty
UIElement.Opacity
UIElement.OpacityMaskProperty
UIElement.OpacityMask
UIElement.IsHitTestVisible
UIElement.IsHitTestVisibleProperty
UIElement.AllowDrop
UIElement.AllowDropProperty
UIElement.CaptureMouse()
UIElement.IsMouseCaptured
UIElement.ReleaseMouseCapture()
UIElement.AllowScrollOnTouchMove
UIElement.AllowScrollOnTouchMoveProperty
UIElement.AddHandler(RoutedEvent, Delegate, Boolean)
UIElement.RemoveHandler(RoutedEvent, Delegate)
UIElement.MouseMoveEvent
UIElement.MouseMove
UIElement.OnMouseMove(MouseEventArgs)
UIElement.MouseLeftButtonDownEvent
UIElement.MouseLeftButtonDown
UIElement.OnMouseLeftButtonDown(MouseButtonEventArgs)
UIElement.MouseRightButtonDownEvent
UIElement.MouseRightButtonDown
UIElement.OnMouseRightButtonDown(MouseButtonEventArgs)
UIElement.MouseWheelEvent
UIElement.MouseWheel
UIElement.OnMouseWheel(MouseWheelEventArgs)
UIElement.MouseLeftButtonUpEvent
UIElement.MouseLeftButtonUp
UIElement.OnMouseLeftButtonUp(MouseButtonEventArgs)
UIElement.MouseEnterEvent
UIElement.MouseEnter
UIElement.OnMouseEnter(MouseEventArgs)
UIElement.MouseLeaveEvent
UIElement.MouseLeave
UIElement.OnMouseLeave(MouseEventArgs)
UIElement.TextInputStartEvent
UIElement.TextInputStart
UIElement.OnTextInputStart(TextCompositionEventArgs)
UIElement.TextInputEvent
UIElement.TextInput
UIElement.OnTextInput(TextCompositionEventArgs)
UIElement.TextInputUpdateEvent
UIElement.TextInputUpdate
UIElement.TappedEvent
UIElement.Tapped
UIElement.OnTapped(TappedRoutedEventArgs)
UIElement.MouseRightButtonUpEvent
UIElement.MouseRightButtonUp
UIElement.OnMouseRightButtonUp(MouseButtonEventArgs)
UIElement.KeyDownEvent
UIElement.KeyDown
UIElement.OnKeyDown(KeyEventArgs)
UIElement.KeyUpEvent
UIElement.KeyUp
UIElement.OnKeyUp(KeyEventArgs)
UIElement.GotFocusEvent
UIElement.GotFocus
UIElement.OnGotFocus(RoutedEventArgs)
UIElement.LostFocusEvent
UIElement.LostFocus
UIElement.OnLostFocus(RoutedEventArgs)
UIElement.LostMouseCapture
UIElement.OnLostMouseCapture(MouseEventArgs)
UIElement.INTERNAL_AttachToDomEvents()
UIElement.INTERNAL_DetachFromDomEvents()
DependencyObject.GetValue(DependencyProperty)
DependencyObject.SetCurrentValue(DependencyProperty, Object)
DependencyObject.ReadLocalValue(DependencyProperty)
DependencyObject.SetValue(DependencyProperty, Object)
DependencyObject.SetValue(DependencyPropertyKey, Object)
DependencyObject.CoerceValue(DependencyProperty)
DependencyObject.Dispatcher
DependencyObject.ClearValue(DependencyProperty)
DependencyObject.ClearValue(DependencyPropertyKey)
DependencyObject.CheckAccess()
DependencyObject.GetAnimationBaseValue(DependencyProperty)
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: System.Windows.Controls
Assembly: OpenSilver.dll
Syntax
public sealed class MediaElement : FrameworkElement, IFrameworkElement, IUIElement, IDependencyObject

Fields

| Improve this Doc View Source

AutoPlayProperty

Identifies the AutoPlay dependency property.

Declaration
public static readonly DependencyProperty AutoPlayProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

BufferingTimeProperty

Identifies the BufferingTime dependency property.

Declaration
[NotImplemented]
public static readonly DependencyProperty BufferingTimeProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

CurrentStateProperty

Identifies the CurrentState dependency property.

Declaration
[NotImplemented]
public static readonly DependencyProperty CurrentStateProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

DownloadProgressOffsetProperty

Identifies the DownloadProgressOffset dependency property.

Declaration
[NotImplemented]
public static readonly DependencyProperty DownloadProgressOffsetProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

DownloadProgressProperty

Identifies the DownloadProgress dependency property.

Declaration
[NotImplemented]
public static readonly DependencyProperty DownloadProgressProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

IsAudioOnlyProperty

Identifies the IsAudioOnly dependency property.

Declaration
public static readonly DependencyProperty IsAudioOnlyProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

IsLoopingProperty

Identifies the IsLooping dependency property.

Declaration
public static readonly DependencyProperty IsLoopingProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

IsMutedProperty

Identifies the IsMuted dependency property.

Declaration
public static readonly DependencyProperty IsMutedProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

NaturalDurationProperty

Identifies the NaturalDuration dependency property.

Declaration
[NotImplemented]
public static readonly DependencyProperty NaturalDurationProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

PositionProperty

Identifies the Position dependency property.

Declaration
[NotImplemented]
public static readonly DependencyProperty PositionProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

ShowControlsProperty

Identifies the ShowControls dependency property.

Declaration
public static readonly DependencyProperty ShowControlsProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

SourceProperty

Identifies the Source dependency property.

Declaration
public static readonly DependencyProperty SourceProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

StretchProperty

Identifies the Stretch dependency property.

Declaration
[NotImplemented]
public static readonly DependencyProperty StretchProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

VolumeProperty

Identifies the Volume dependency property.

Declaration
public static readonly DependencyProperty VolumeProperty
Field Value
Type Description
DependencyProperty

Properties

| Improve this Doc View Source

AutoPlay

Gets or sets a value that indicates whether media will begin playback automatically when the Source property is set.

Declaration
public bool AutoPlay { get; set; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

BufferingTime

The amount of time to buffer. The default value is a System.TimeSpan with value of 5 seconds (0:0:05).

Declaration
[NotImplemented]
public TimeSpan BufferingTime { get; set; }
Property Value
Type Description
System.TimeSpan
| Improve this Doc View Source

CurrentState

Gets the status of the MediaElement.

Declaration
[NotImplemented]
public MediaElementState CurrentState { get; }
Property Value
Type Description
MediaElementState
| Improve this Doc View Source

DownloadProgress

Gets a percentage value indicating the amount of download completed for content located on a remote server.

Declaration
[NotImplemented]
public double DownloadProgress { get; }
Property Value
Type Description
System.Double
| Improve this Doc View Source

DownloadProgressOffset

Gets the offset of the download progress.

Declaration
[NotImplemented]
public double DownloadProgressOffset { get; }
Property Value
Type Description
System.Double
| Improve this Doc View Source

IsAudioOnly

Gets a value that reports whether the current source media is an audio-only media file.

Declaration
public bool IsAudioOnly { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

IsLooping

Gets or sets a value that describes whether the media source currently loaded in the media engine should automatically set the position to the media start after reaching its end.

Declaration
public bool IsLooping { get; set; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

IsMuted

Gets or sets a value indicating whether the audio is muted.

Declaration
public bool IsMuted { get; set; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

Markers

The collection of timeline markers (represented as TimelineMarker objects) associated with the currently loaded media file.

Declaration
[NotImplemented]
public TimelineMarkerCollection Markers { get; }
Property Value
Type Description
TimelineMarkerCollection
| Improve this Doc View Source

NaturalDuration

Gets the duration of the media file currently opened.

Declaration
[NotImplemented]
public Duration NaturalDuration { get; }
Property Value
Type Description
Duration
| Improve this Doc View Source

Position

Gets or sets the current position of progress through the media's playback time.

Declaration
[NotImplemented]
public TimeSpan Position { get; set; }
Property Value
Type Description
System.TimeSpan
| Improve this Doc View Source

ShowControls

Declaration
public bool ShowControls { get; set; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

Source

Gets or sets a media source on the MediaElement.

Declaration
public Uri Source { get; set; }
Property Value
Type Description
System.Uri
| Improve this Doc View Source

Stretch

Gets or sets a Stretch value that describes how a MediaElement fills the destination rectangle.

Declaration
[NotImplemented]
public Stretch Stretch { get; set; }
Property Value
Type Description
Stretch
| Improve this Doc View Source

Volume

Gets or sets the media's volume.

Declaration
public double Volume { get; set; }
Property Value
Type Description
System.Double

Methods

| Improve this Doc View Source

CanPlayType(String)

Returns an enumeration value that describes the likelihood that the current MediaElement and its client configuration can play that media source.

Declaration
public MediaCanPlayResponse CanPlayType(string type)
Parameters
Type Name Description
System.String type

A string that describes the desired type as a string.

Returns
Type Description
MediaCanPlayResponse

A value of the enumeration that describes the likelihood that the current media engine can play the source.

| Improve this Doc View Source

CreateDomElement(Object, out Object)

Declaration
public override object CreateDomElement(object parentRef, out object domElementWhereToPlaceChildren)
Parameters
Type Name Description
System.Object parentRef
System.Object domElementWhereToPlaceChildren
Returns
Type Description
System.Object
Overrides
FrameworkElement.CreateDomElement(Object, out Object)
| Improve this Doc View Source

OnCreateAutomationPeer()

Declaration
protected override AutomationPeer OnCreateAutomationPeer()
Returns
Type Description
AutomationPeer
Overrides
UIElement.OnCreateAutomationPeer()
| Improve this Doc View Source

Pause()

Pauses media at the current position.

Declaration
public void Pause()
| Improve this Doc View Source

Play()

Plays media from the current position.

Declaration
public void Play()
| Improve this Doc View Source

SetSource(Stream)

Sets the Source property using the supplied stream.

Declaration
[NotImplemented]
public void SetSource(Stream stream)
Parameters
Type Name Description
System.IO.Stream stream

A stream that contains a natively supported media source.

| Improve this Doc View Source

Stop()

Stops and resets media to be played from the beginning.

Declaration
[NotImplemented]
public void Stop()

Events

| Improve this Doc View Source

CurrentStateChanged

Occurs when the value of the CurrentState property changes.

Declaration
[NotImplemented]
public event RoutedEventHandler CurrentStateChanged
Event Type
Type Description
RoutedEventHandler
| Improve this Doc View Source

DownloadProgressChanged

Occurs when the DownloadProgress property has changed.

Declaration
[NotImplemented]
public event RoutedEventHandler DownloadProgressChanged
Event Type
Type Description
RoutedEventHandler
| Improve this Doc View Source

MediaEnded

Occurs when the MediaElement is no longer playing audio or video.

Declaration
[NotImplemented]
public event RoutedEventHandler MediaEnded
Event Type
Type Description
RoutedEventHandler
| Improve this Doc View Source

MediaFailed

Declaration
[NotImplemented]
public event EventHandler<ExceptionRoutedEventArgs> MediaFailed
Event Type
Type Description
System.EventHandler<ExceptionRoutedEventArgs>
| Improve this Doc View Source

MediaOpened

Declaration
[NotImplemented]
public event RoutedEventHandler MediaOpened
Event Type
Type Description
RoutedEventHandler

Extension Methods

DependencyObjectHelper.GetSelfAndAncestors(DependencyObject)
UIElementExtendedRoutedEventExtensions.AddHandler(UIElement, ExtendedRoutedEvent, Delegate, Boolean)
UIElementExtendedRoutedEventExtensions.RemoveHandler(UIElement, ExtendedRoutedEvent, Delegate)
VisualTreeExtensions.GetVisualAncestors(DependencyObject)
VisualTreeExtensions.GetVisualAncestorsAndSelf(DependencyObject)
VisualTreeExtensions.GetVisualChildren(DependencyObject)
VisualTreeExtensions.GetVisualChildrenAndSelf(DependencyObject)
VisualTreeExtensions.GetVisualDescendants(DependencyObject)
VisualTreeExtensions.GetVisualDescendantsAndSelf(DependencyObject)
VisualTreeExtensions.GetVisualSiblings(DependencyObject)
VisualTreeExtensions.GetVisualSiblingsAndSelf(DependencyObject)
VisualTreeExtensions.GetBoundsRelativeTo(FrameworkElement, UIElement)
VisualTreeExtensions.InvokeOnLayoutUpdated(FrameworkElement, Action)
  • Improve this Doc
  • View Source