Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Media Element Metadata #521

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions docs/maui/views/MediaElement.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,17 +210,18 @@ remote URL with artwork for the lockscreen. It should be at least 1080P for best
<toolkit:MediaElement
MetadataTitle="Title"
MetadataArtist="Artist"
MetadataArtworkUrl="http://www.myownpersonaldomain.com/image.jpg" />
MetadataArtworkUrl= "http://www.myownpersonaldomain.com/image.jpg" />
```

```csharp
MediaElement.MetadataTitle="Title";
MediaElement.MetadataArtist="Artist";
MediaElement.MetadataArtworkUrl="http://www.myownpersonaldomain.com/image.jpg";
MediaElement.MetadataArtworkUrl= MediaSource.FromUri("http://www.myownpersonaldomain.com/image.jpg");
```

> [!IMPORTANT]
> You can set the metadata in either XAML or code behind. If you are setting it in code behind you need to set the source in code behind. The source should
> You can set the metadata in either XAML or code behind. MetaData for artwork uses `MediaSource` to set source for artwork. You can use File Resource,
a Url or embedded image from App Package. If you are setting it in code behind you need to set the source in code behind. The source should
be set last. If you set the metadata in XAML or in constructor this note can be safely ignored.

### Play local media
Expand Down Expand Up @@ -444,6 +445,9 @@ To read more about handlers, please see the .NET MAUI documentation on [Handlers
| Aspect | [Aspect](xref:Microsoft.Maui.Aspect) | Determines the scaling mode for the (visual) media that is currently loaded. This is a bindable property. | `Aspect.AspectFit` |
| CurrentState | `MediaElementState` | Indicates the current status of the control. This is a read-only, bindable property. | `MediaElementState.None` |
| Duration | `TimeSpan` | Indicates the duration of the currently opened media. This is a read-only, bindable property. | `TimeSpan.Zero` |
| MetadataArtist | `string` | The name of the artist of the media source. |
| MetadataArtworkUrl | `MediaSource` | Sets the artwork for media source. |
| MetadataTitle | `string` | Sets the Title of the media source. |
| Position | `TimeSpan` | Describes the current progress through the media's playback time. This is a read-only, bindable property. If you want to set the `Position` use the `SeekTo()` method. | `TimeSpan.Zero` |
| ShouldAutoPlay | `bool` | Indicates whether media playback will begin automatically when the `Source` property is set. This is a bindable property. | `false` |
| ShouldLoopPlayback | `bool` | Describes whether the currently loaded media source should resume playback from the start after reaching its end. This is a bindable property. | `false` |
Expand Down