Playing Custom Media Formats
You can plug custom behavior into the media pipeline with a class called MediaStreamSource from the Windows.Media.Core namespace. To do this, you:
1. Configure an instance of MediaStreamSource with encoding information about the audio and/or video data you’re going to produce
2. Tell the MediaStreamSource how long the media will be by setting its Duration property
3. Provide a callback with which you will deliver the audio samples by attaching a handler to its SampleRequested event
4. Set the MediaStreamSource as the source of a MediaElement by passing it to MediaElement’s SetMediaStreamSource method instead of SetSource
MediaStreamSource would be typically used to retrieve existing media, perhaps via a custom mechanism, ...
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