Share via


MediaSource Class

Definition

Represents a single-use source for media data. A MediaSource corresponds to exactly one load operation. It holds a single underlying Stream that will be consumed by a media component. Reuse of an instance for multiple components or multiple loads is not supported.

public class MediaSource
type MediaSource = class
Public Class MediaSource
Inheritance
MediaSource

Constructors

Name Description
MediaSource(Byte[], String, String)

Initializes a new instance of MediaSource with byte array data. A non-writable MemoryStream is created over the provided data. The byte array reference is not copied, so callers should not mutate it afterwards.

MediaSource(Stream, String, String)

Initializes a new instance of MediaSource from an existing stream. The stream reference is retained (not copied). The caller retains ownership and is responsible for disposal after the media has loaded. The stream must remain readable for the duration of the load.

Properties

Name Description
CacheKey

Gets the cache key for the media. Always non-null.

Length

Gets the length of the media data in bytes if known.

MimeType

Gets the MIME type of the media.

Stream

Gets the underlying stream.

Applies to