AdaptiveMediaSource AdaptiveMediaSource AdaptiveMediaSource AdaptiveMediaSource Class

Definition

Represents the source of adaptive streaming content.

public : sealed class AdaptiveMediaSource : IClosable, IMediaSource, IAdaptiveMediaSource, IAdaptiveMediaSource2, IAdaptiveMediaSource3
public sealed class AdaptiveMediaSource : IDisposable, IMediaSource, IAdaptiveMediaSource, IAdaptiveMediaSource2, IAdaptiveMediaSource3
Public NotInheritable Class AdaptiveMediaSource Implements IDisposable, IMediaSource, IAdaptiveMediaSource, IAdaptiveMediaSource2, IAdaptiveMediaSource3
// This class does not provide a public constructor.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

Call one of the CreateFromStreamAsync or CreateFromUriAsync methods to create a AdaptiveMediaSource object with a specific adaptive streaming manifest source.

For how-to guidance for using adaptive streaming in your app, see Adaptive streaming.

Properties

AdvancedSettings AdvancedSettings AdvancedSettings AdvancedSettings

Gets the advanced settings for the adaptive media source.

public : AdaptiveMediaSourceAdvancedSettings AdvancedSettings { get; }
public AdaptiveMediaSourceAdvancedSettings AdvancedSettings { get; }
Public ReadOnly Property AdvancedSettings As AdaptiveMediaSourceAdvancedSettings
var adaptiveMediaSourceAdvancedSettings = adaptiveMediaSource.advancedSettings;
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10586.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v2)

AudioOnlyPlayback AudioOnlyPlayback AudioOnlyPlayback AudioOnlyPlayback

Gets a value indicating if the content streamed by the media source contains only audio.

public : Platform::Boolean AudioOnlyPlayback { get; }
public bool AudioOnlyPlayback { get; }
Public ReadOnly Property AudioOnlyPlayback As bool
var bool = adaptiveMediaSource.audioOnlyPlayback;
Value
Platform::Boolean bool bool bool

True if the content only contains audio; otherwise, false.

Remarks

Check the value of this property to determine if the media content is audio-only and adjust your UI accordingly.

AvailableBitrates AvailableBitrates AvailableBitrates AvailableBitrates

Gets the available adaptive bit rates of the adaptive streaming manifest that is the source of the adaptive streaming object.

public : IVectorView<unsigned int> AvailableBitrates { get; }
public IReadOnlyList<uint> AvailableBitrates { get; }
Public ReadOnly Property AvailableBitrates As IReadOnlyList<uint>
var iReadOnlyList = adaptiveMediaSource.availableBitrates;
Value
IVectorView<unsigned int> IReadOnlyList<uint> IReadOnlyList<uint> IReadOnlyList<uint>

The list of available adaptive bit rates of the adaptive streaming manifest.

CurrentDownloadBitrate CurrentDownloadBitrate CurrentDownloadBitrate CurrentDownloadBitrate

Gets a value indicating the current download bitrate for the media source.

public : unsigned int CurrentDownloadBitrate { get; }
public uint CurrentDownloadBitrate { get; }
Public ReadOnly Property CurrentDownloadBitrate As uint
var uint = adaptiveMediaSource.currentDownloadBitrate;
Value
unsigned int uint uint uint

The current download bitrate for the media source.

CurrentPlaybackBitrate CurrentPlaybackBitrate CurrentPlaybackBitrate CurrentPlaybackBitrate

Gets a value indicating the current playback bitrate for the media source.

public : unsigned int CurrentPlaybackBitrate { get; }
public uint CurrentPlaybackBitrate { get; }
Public ReadOnly Property CurrentPlaybackBitrate As uint
var uint = adaptiveMediaSource.currentPlaybackBitrate;
Value
unsigned int uint uint uint

The current playback bitrate for the media source.

DesiredLiveOffset DesiredLiveOffset DesiredLiveOffset DesiredLiveOffset

Gets or sets the desired offset of live playback from the end of the known media content that has been downloaded.

public : TimeSpan DesiredLiveOffset { get; set; }
public TimeSpan DesiredLiveOffset { get; set; }
Public ReadWrite Property DesiredLiveOffset As TimeSpan
var timeSpan = adaptiveMediaSource.desiredLiveOffset;
adaptiveMediaSource.desiredLiveOffset = timeSpan;
Value
TimeSpan TimeSpan TimeSpan TimeSpan

The desired offset for the live playback of the streaming media. This value must be greater than MinLiveOffset. If the specified value is less than the minimum value, it is automatically clamped to the allowed range.

See Also

DesiredMaxBitrate DesiredMaxBitrate DesiredMaxBitrate DesiredMaxBitrate

Gets or sets the desired maximum bitrate for the media source.

public : IReference<unsigned int> DesiredMaxBitrate { get; set; }
public Nullable<uint> DesiredMaxBitrate { get; set; }
Public ReadWrite Property DesiredMaxBitrate As Nullable<uint>
var nullable = adaptiveMediaSource.desiredMaxBitrate;
adaptiveMediaSource.desiredMaxBitrate = nullable;
Value
IReference<unsigned int> Nullable<uint> Nullable<uint> Nullable<uint>

The desired maximum bitrate for the streaming media.

DesiredMinBitrate DesiredMinBitrate DesiredMinBitrate DesiredMinBitrate

Gets or sets the desired minimum bitrate for the media source.

public : IReference<unsigned int> DesiredMinBitrate { get; set; }
public Nullable<uint> DesiredMinBitrate { get; set; }
Public ReadWrite Property DesiredMinBitrate As Nullable<uint>
var nullable = adaptiveMediaSource.desiredMinBitrate;
adaptiveMediaSource.desiredMinBitrate = nullable;
Value
IReference<unsigned int> Nullable<uint> Nullable<uint> Nullable<uint>

The desired minimum bitrate for the streaming media.

DesiredSeekableWindowSize DesiredSeekableWindowSize DesiredSeekableWindowSize DesiredSeekableWindowSize

Gets or sets the requested maximum size of the time window within which the user can seek within the streaming media.

public : IReference<TimeSpan> DesiredSeekableWindowSize { get; set; }
public Nullable<TimeSpan> DesiredSeekableWindowSize { get; set; }
Public ReadWrite Property DesiredSeekableWindowSize As Nullable<TimeSpan>
var nullable = adaptiveMediaSource.desiredSeekableWindowSize;
adaptiveMediaSource.desiredSeekableWindowSize = nullable;
Value
IReference<TimeSpan> Nullable<TimeSpan> Nullable<TimeSpan> Nullable<TimeSpan>

The requested maximum size of the time window in which the user can seek within the streaming media. This value must be between zero and the value of MaxSeekableWindowSize. If the specified value is greater than the maximum value, the system automatically clamps to the allowed range, but when you retrieve the property it will return the unclamped value.

Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

Diagnostics Diagnostics Diagnostics Diagnostics

Gets an object that provides an event that is raised when diagnostic information about the adaptive media source is available.

public : AdaptiveMediaSourceDiagnostics Diagnostics { get; }
public AdaptiveMediaSourceDiagnostics Diagnostics { get; }
Public ReadOnly Property Diagnostics As AdaptiveMediaSourceDiagnostics
var adaptiveMediaSourceDiagnostics = adaptiveMediaSource.diagnostics;
Value
AdaptiveMediaSourceDiagnostics AdaptiveMediaSourceDiagnostics AdaptiveMediaSourceDiagnostics AdaptiveMediaSourceDiagnostics

An object that provides an event that is raised when diagnostic information about the adaptive media source is available.

Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

InboundBitsPerSecond InboundBitsPerSecond InboundBitsPerSecond InboundBitsPerSecond

Gets a value indicating the inbound bits per second statistic over the time window specified by the InboundBitsPerSecondWindow property.

public : ulong InboundBitsPerSecond { get; }
public ulong InboundBitsPerSecond { get; }
Public ReadOnly Property InboundBitsPerSecond As ulong
var ulong = adaptiveMediaSource.inboundBitsPerSecond;
Value
ulong ulong ulong ulong

The inbound bits per second over the InboundBitsPerSecondWindow time span.

InboundBitsPerSecondWindow InboundBitsPerSecondWindow InboundBitsPerSecondWindow InboundBitsPerSecondWindow

Gets or sets the time span over which the InboundBitsPerSecond property is calculated.

public : TimeSpan InboundBitsPerSecondWindow { get; set; }
public TimeSpan InboundBitsPerSecondWindow { get; set; }
Public ReadWrite Property InboundBitsPerSecondWindow As TimeSpan
var timeSpan = adaptiveMediaSource.inboundBitsPerSecondWindow;
adaptiveMediaSource.inboundBitsPerSecondWindow = timeSpan;
Value
TimeSpan TimeSpan TimeSpan TimeSpan

The time span over which the InboundBitsPerSecond property is calculated.

Remarks

The default value for this property is a time span of 5 minutes.

InitialBitrate InitialBitrate InitialBitrate InitialBitrate

Gets and sets the initial bit rate to use for playback of the media source.

public : unsigned int InitialBitrate { get; set; }
public uint InitialBitrate { get; set; }
Public ReadWrite Property InitialBitrate As uint
var uint = adaptiveMediaSource.initialBitrate;
adaptiveMediaSource.initialBitrate = uint;
Value
unsigned int uint uint uint

The initial bit rate to use for playback.

IsLive IsLive IsLive IsLive

Gets a value that indicates whether the media source is live.

public : Platform::Boolean IsLive { get; }
public bool IsLive { get; }
Public ReadOnly Property IsLive As bool
var bool = adaptiveMediaSource.isLive;
Value
Platform::Boolean bool bool bool

A value that indicates whether playback of the adaptive streaming object is live. true if live; otherwise, false.

MaxSeekableWindowSize MaxSeekableWindowSize MaxSeekableWindowSize MaxSeekableWindowSize

Gets the maximum time window within which the user can seek within the streaming media.

public : IReference<TimeSpan> MaxSeekableWindowSize { get; }
public Nullable<TimeSpan> MaxSeekableWindowSize { get; }
Public ReadOnly Property MaxSeekableWindowSize As Nullable<TimeSpan>
var nullable = adaptiveMediaSource.maxSeekableWindowSize;
Value
IReference<TimeSpan> Nullable<TimeSpan> Nullable<TimeSpan> Nullable<TimeSpan>

The maximum time window within which the user can seek within the streaming media.

Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

Remarks

This time window is calculated by taking the total duration of media that has been downloaded and subtracting the value of the DesiredLiveOffset property. This value is specified by the media content.

MinLiveOffset MinLiveOffset MinLiveOffset MinLiveOffset

Gets the minimum offset of live playback from the end of the known media content that has been downloaded.

public : IReference<TimeSpan> MinLiveOffset { get; }
public Nullable<TimeSpan> MinLiveOffset { get; }
Public ReadOnly Property MinLiveOffset As Nullable<TimeSpan>
var nullable = adaptiveMediaSource.minLiveOffset;
Value
IReference<TimeSpan> Nullable<TimeSpan> Nullable<TimeSpan> Nullable<TimeSpan>

The minimum offset of live playback from the end of the known media content that has been downloaded.

Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

Remarks

This property specifies the minimum value to which the DesiredLiveOffset property can be set. This value is specified by the media content or platform.

Methods

Close() Close() Close() Close()

Closes the adaptive media source and frees up associated resources.

public : void Close()
This member is not implemented in C#
This member is not implemented in VB.Net
adaptiveMediaSource.close();
Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

Remarks

Call this method when you are done with the adaptive media source, such as when switching to a different media source, to ensure that the resources are cleaned up and that network operations for this adaptive media source are stopped.

CreateFromStreamAsync(IInputStream, Uri, String) CreateFromStreamAsync(IInputStream, Uri, String) CreateFromStreamAsync(IInputStream, Uri, String) CreateFromStreamAsync(IInputStream, Uri, String)

Asynchronously creates a AdaptiveMediaSource object from the provided input stream.

public : static IAsyncOperation<AdaptiveMediaSourceCreationResult> CreateFromStreamAsync(IInputStream stream, Uri uri, Platform::String contentType)
public static IAsyncOperation<AdaptiveMediaSourceCreationResult> CreateFromStreamAsync(IInputStream stream, Uri uri, String contentType)
Public Static Function CreateFromStreamAsync(stream As IInputStream, uri As Uri, contentType As String) As IAsyncOperation( Of AdaptiveMediaSourceCreationResult )
Windows.Media.Streaming.Adaptive.AdaptiveMediaSource.createFromStreamAsync(stream, uri, contentType).done( /* Your success and error handlers */ );
Parameters
stream
IInputStream IInputStream IInputStream IInputStream

The input stream from which the AdaptiveMediaSource is created.

uri
Uri Uri Uri Uri

The Uniform Resource Identifier (URI) of the source. This is used by the AdaptiveMediaSource to resolve relative URIs.

contentType
Platform::String String String String

A string that identifies the MIME content type of the source. This can be an Http Live Streaming (HLS) or a Dynamic Adaptive Streaming over HTTP (DASH) content type.

Returns
See Also

CreateFromStreamAsync(IInputStream, Uri, String, HttpClient) CreateFromStreamAsync(IInputStream, Uri, String, HttpClient) CreateFromStreamAsync(IInputStream, Uri, String, HttpClient) CreateFromStreamAsync(IInputStream, Uri, String, HttpClient)

Asynchronously creates a AdaptiveMediaSource object from the provided input stream.

public : static IAsyncOperation<AdaptiveMediaSourceCreationResult> CreateFromStreamAsync(IInputStream stream, Uri uri, Platform::String contentType, HttpClient httpClient)
public static IAsyncOperation<AdaptiveMediaSourceCreationResult> CreateFromStreamAsync(IInputStream stream, Uri uri, String contentType, HttpClient httpClient)
Public Static Function CreateFromStreamAsync(stream As IInputStream, uri As Uri, contentType As String, httpClient As HttpClient) As IAsyncOperation( Of AdaptiveMediaSourceCreationResult )
Windows.Media.Streaming.Adaptive.AdaptiveMediaSource.createFromStreamAsync(stream, uri, contentType, httpClient).done( /* Your success and error handlers */ );
Parameters
stream
IInputStream IInputStream IInputStream IInputStream

The input stream from which the AdaptiveMediaSource is created.

uri
Uri Uri Uri Uri

The Uniform Resource Identifier (URI) of the source. This is used by the AdaptiveMediaSource to resolve relative URIs.

contentType
Platform::String String String String

A string that identifies the MIME content type of the source. This can be an Http Live Streaming (HLS) or a Dynamic Adaptive Streaming over HTTP (DASH) content type.

httpClient
HttpClient HttpClient HttpClient HttpClient

The HttpClient instance that the AdaptiveMediaSource should use for downloading resources. This allows you to specify custom HTTP headers for the requests.

Returns
See Also

CreateFromUriAsync(Uri) CreateFromUriAsync(Uri) CreateFromUriAsync(Uri) CreateFromUriAsync(Uri)

Asynchronously creates a AdaptiveMediaSource object from the Uniform Resource Identifier (URI) of the source.

public : static IAsyncOperation<AdaptiveMediaSourceCreationResult> CreateFromUriAsync(Uri uri)
public static IAsyncOperation<AdaptiveMediaSourceCreationResult> CreateFromUriAsync(Uri uri)
Public Static Function CreateFromUriAsync(uri As Uri) As IAsyncOperation( Of AdaptiveMediaSourceCreationResult )
Windows.Media.Streaming.Adaptive.AdaptiveMediaSource.createFromUriAsync(uri).done( /* Your success and error handlers */ );
Parameters
uri
Uri Uri Uri Uri

T he Uniform Resource Identifier (URI) of the source.

Returns
See Also

CreateFromUriAsync(Uri, HttpClient) CreateFromUriAsync(Uri, HttpClient) CreateFromUriAsync(Uri, HttpClient) CreateFromUriAsync(Uri, HttpClient)

Asynchronously creates a AdaptiveMediaSource object from the Uniform Resource Identifier (URI) of the source.

public : static IAsyncOperation<AdaptiveMediaSourceCreationResult> CreateFromUriAsync(Uri uri, HttpClient httpClient)
public static IAsyncOperation<AdaptiveMediaSourceCreationResult> CreateFromUriAsync(Uri uri, HttpClient httpClient)
Public Static Function CreateFromUriAsync(uri As Uri, httpClient As HttpClient) As IAsyncOperation( Of AdaptiveMediaSourceCreationResult )
Windows.Media.Streaming.Adaptive.AdaptiveMediaSource.createFromUriAsync(uri, httpClient).done( /* Your success and error handlers */ );
Parameters
uri
Uri Uri Uri Uri

The Uniform Resource Identifier (URI) of the source.

httpClient
HttpClient HttpClient HttpClient HttpClient

The HttpClient instance that the AdaptiveMediaSource should use for downloading resources. This allows you to specify custom HTTP headers for the requests.

Returns
See Also

Dispose() Dispose() Dispose() Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

This member is not implemented in C++
void Dispose()
Sub Dispose
void Dispose()

GetCorrelatedTimes() GetCorrelatedTimes() GetCorrelatedTimes() GetCorrelatedTimes()

Gets an object that provides timing information that is correlated between timestamps in the media or date/time information from the manifest with the presentation clock timeline.

public : AdaptiveMediaSourceCorrelatedTimes GetCorrelatedTimes()
public AdaptiveMediaSourceCorrelatedTimes GetCorrelatedTimes()
Public Function GetCorrelatedTimes() As AdaptiveMediaSourceCorrelatedTimes
var adaptiveMediaSourceCorrelatedTimes = adaptiveMediaSource.getCorrelatedTimes();
Returns
Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

IsContentTypeSupported(String) IsContentTypeSupported(String) IsContentTypeSupported(String) IsContentTypeSupported(String)

Determines whether the content type of the source is supported.

public : static Platform::Boolean IsContentTypeSupported(Platform::String contentType)
public static bool IsContentTypeSupported(String contentType)
Public Static Function IsContentTypeSupported(contentType As String) As bool
var bool = Windows.Media.Streaming.Adaptive.AdaptiveMediaSource.isContentTypeSupported(contentType);
Parameters
contentType
Platform::String String String String

A string that identifies the content type of the source. Can be a Http Live Streaming (HLS) or Dynamic Adaptive Streaming over HTTP (DASH) content type.

Returns
Platform::Boolean bool bool bool

Returns a value that indicates whether the content type of the source is supported. true if supported; otherwise, false.

Events

DownloadBitrateChanged DownloadBitrateChanged DownloadBitrateChanged DownloadBitrateChanged

Occurs when the CurrentDownloadBitrate changes.

public : event TypedEventHandler DownloadBitrateChanged<AdaptiveMediaSource, AdaptiveMediaSourceDownloadBitrateChangedEventArgs>
public event TypedEventHandler DownloadBitrateChanged<AdaptiveMediaSource, AdaptiveMediaSourceDownloadBitrateChangedEventArgs>
Public Event TypedEventHandler DownloadBitrateChanged( Of ( Of AdaptiveMediaSource ), ( Of AdaptiveMediaSourceDownloadBitrateChangedEventArgs ))
function onDownloadBitrateChanged(eventArgs){/* Your code */}


adaptiveMediaSource.addEventListener("downloadBitrateChanged", onDownloadBitrateChanged);
adaptiveMediaSource.removeEventListener("downloadBitrateChanged", onDownloadBitrateChanged);

DownloadCompleted DownloadCompleted DownloadCompleted DownloadCompleted

Occurs when a resource download operation completes

public : event TypedEventHandler DownloadCompleted<AdaptiveMediaSource, AdaptiveMediaSourceDownloadCompletedEventArgs>
public event TypedEventHandler DownloadCompleted<AdaptiveMediaSource, AdaptiveMediaSourceDownloadCompletedEventArgs>
Public Event TypedEventHandler DownloadCompleted( Of ( Of AdaptiveMediaSource ), ( Of AdaptiveMediaSourceDownloadCompletedEventArgs ))
function onDownloadCompleted(eventArgs){/* Your code */}


adaptiveMediaSource.addEventListener("downloadCompleted", onDownloadCompleted);
adaptiveMediaSource.removeEventListener("downloadCompleted", onDownloadCompleted);

DownloadFailed DownloadFailed DownloadFailed DownloadFailed

Occurs when a resource download operation fails.

public : event TypedEventHandler DownloadFailed<AdaptiveMediaSource, AdaptiveMediaSourceDownloadFailedEventArgs>
public event TypedEventHandler DownloadFailed<AdaptiveMediaSource, AdaptiveMediaSourceDownloadFailedEventArgs>
Public Event TypedEventHandler DownloadFailed( Of ( Of AdaptiveMediaSource ), ( Of AdaptiveMediaSourceDownloadFailedEventArgs ))
function onDownloadFailed(eventArgs){/* Your code */}


adaptiveMediaSource.addEventListener("downloadFailed", onDownloadFailed);
adaptiveMediaSource.removeEventListener("downloadFailed", onDownloadFailed);

DownloadRequested DownloadRequested DownloadRequested DownloadRequested

Occurs when a resource download operation is requested.

public : event TypedEventHandler DownloadRequested<AdaptiveMediaSource, AdaptiveMediaSourceDownloadRequestedEventArgs>
public event TypedEventHandler DownloadRequested<AdaptiveMediaSource, AdaptiveMediaSourceDownloadRequestedEventArgs>
Public Event TypedEventHandler DownloadRequested( Of ( Of AdaptiveMediaSource ), ( Of AdaptiveMediaSourceDownloadRequestedEventArgs ))
function onDownloadRequested(eventArgs){/* Your code */}


adaptiveMediaSource.addEventListener("downloadRequested", onDownloadRequested);
adaptiveMediaSource.removeEventListener("downloadRequested", onDownloadRequested);

Remarks

Handle this event to modify parameters of the resource download operation before the operation begins.

PlaybackBitrateChanged PlaybackBitrateChanged PlaybackBitrateChanged PlaybackBitrateChanged

Occurs when the CurrentPlaybackBitrate changes.

public : event TypedEventHandler PlaybackBitrateChanged<AdaptiveMediaSource, AdaptiveMediaSourcePlaybackBitrateChangedEventArgs>
public event TypedEventHandler PlaybackBitrateChanged<AdaptiveMediaSource, AdaptiveMediaSourcePlaybackBitrateChangedEventArgs>
Public Event TypedEventHandler PlaybackBitrateChanged( Of ( Of AdaptiveMediaSource ), ( Of AdaptiveMediaSourcePlaybackBitrateChangedEventArgs ))
function onPlaybackBitrateChanged(eventArgs){/* Your code */}


adaptiveMediaSource.addEventListener("playbackBitrateChanged", onPlaybackBitrateChanged);
adaptiveMediaSource.removeEventListener("playbackBitrateChanged", onPlaybackBitrateChanged);

See Also