IMediaElement Interface
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
With MediaElement you can play multimedia inside your app.
public interface IMediaElement : CommunityToolkit.Maui.Core.IAsynchronousMediaElementHandler, Microsoft.Maui.IView
type IMediaElement = interface
interface IView
interface IElement
interface ITransform
interface IAsynchronousMediaElementHandler
Public Interface IMediaElement
Implements IAsynchronousMediaElementHandler, IView
- Derived
- Implements
Properties
| Name | Description |
|---|---|
| Aspect |
Gets the media aspect ratio. |
| CurrentState |
The current state of the MediaElement. |
| Duration |
Gets total duration of the loaded media. |
| MediaHeight |
Gets the height (in pixels) of the loaded media in pixels. |
| MediaWidth |
Gets the width (in pixels) of the loaded media in pixels. |
| MetadataArtist |
Gets or sets the artist of the media. |
| MetadataArtworkUrl |
Gets or sets the artwork Image Url. |
| MetadataTitle |
Gets or sets the title of the media. |
| Position |
The current position of the playing media. |
| SeekCompletedTCS |
A TaskCompletionSource to provide Handlers an asynchronous way to complete (Inherited from IAsynchronousMediaElementHandler) |
| ShouldAutoPlay |
Gets or sets whether the media should start playing as soon as it's loaded. |
| ShouldKeepScreenOn |
Gets or sets if media playback will prevent the device display from going to sleep. |
| ShouldLoopPlayback |
Gets or sets if the media playback will restart from the beginning when it reaches the end. |
| ShouldMute |
Gets or sets if audio should be muted. |
| ShouldShowPlaybackControls |
Gets or sets whether the player should show the platform playback controls. |
| Source |
Gets or sets the source of the media to play. |
| Speed |
Gets or sets the speed with which the media should be played. |
| Volume |
Gets or sets the volume of the audio for the media. |
Methods
| Name | Description |
|---|---|
| MediaEnded() |
Occurs when the media has ended playing successfully. |
| MediaFailed(MediaFailedEventArgs) |
Occurs when the media has failed loading. |
| MediaOpened() |
Occurs when the media has been loaded and is ready to play. |
| Pause() |
Pauses the currently playing media. |
| Play() |
Starts playing the loaded media. |
| SeekTo(TimeSpan, CancellationToken) |
Seek to a specific position in the currently playing media. |
| Stop() |
Stops playing the currently playing media and resets the Position. |
Events
| Name | Description |
|---|---|
| PositionChanged |
Occurs when the Position changes; |
| StateChanged |
Occurs when CurrentState changed. |