Windows.UI.Xaml.Controls.MediaElement.SetSource
September 14, 2021 ยท View on GitHub
-description
Sets the Source property using the specified stream and MIME type.
-parameters
-param stream
The stream that contains the media to load.
-param mimeType
The MIME type of the media resource, expressed as the string form typically seen in HTTP headers and requests. The empty string "" can be passed in as the mimeType value if the MIME type is unknown.
-remarks
You can use the FileOpenPicker control to get the file stream for a media file on the local system.
-examples
Here is some code that creates MediaElement object and sets the media source using a FileOpenPicker control.
[!code-xamlMediaElementXaml]
[!code-csharpPlaybackLocalFileAll]
-see-also
Audio, video, and camera, Create custom transport controls, Supported audio and video formats