The Media Content
MediaElement has a SetSource method just like BitmapSource’s method seen in Chapter 11, so you can easily initialize it with an IRandomAccessStream that comes from a variety of sources, such as a file that a user retrieves from the file picker or files that you programmatically retrieve from the user’s Videos library. However, MediaElement’s SetSource method also requires you to pass the relevant MIME type (as a string) in order to determine the format of the media file. For a video stream, this would be a string such as video/mp4, video/x-ms-asf, or video/x-ms-wmv. For an audio stream, this would be a string such as audio/mp3 or audio/x-ms-wma. Fortunately, every StorageFile exposes its MIME type via its ContentType property. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access