Share via


PlayToSourceRequest Class

Definition

Represents a request to connect a media element with a Play To target.

public ref class PlayToSourceRequest sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Deprecated("PlayToSourceRequest may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class PlayToSourceRequest final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Deprecated("PlayToSourceRequest may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.Foundation.UniversalApiContract")]
class PlayToSourceRequest final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Deprecated("PlayToSourceRequest may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class PlayToSourceRequest
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Deprecated("PlayToSourceRequest may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.Foundation.UniversalApiContract")]
public sealed class PlayToSourceRequest
Public NotInheritable Class PlayToSourceRequest
Inheritance
Object Platform::Object IInspectable PlayToSourceRequest
Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Examples

// Play To Contract

private Windows.Media.PlayTo.PlayToManager ptm = 
        Windows.Media.PlayTo.PlayToManager.GetForCurrentView();

protected override void OnNavigatedTo(NavigationEventArgs e)
{
    ptm.SourceRequested += sourceRequestHandler;
}

private void sourceRequestHandler(
    Windows.Media.PlayTo.PlayToManager sender,
    Windows.Media.PlayTo.PlayToSourceRequestedEventArgs e)
{
    try
    {
        e.SourceRequest.SetSource(mediaElement.PlayToSource);
    }
    catch (Exception ex)
    {
        messageBlock.Text += "Exception encountered: " + ex.Message + "\n";
    }
}
' Play To Contract

Private ptm As Windows.Media.PlayTo.PlayToManager =
        Windows.Media.PlayTo.PlayToManager.GetForCurrentView()

Protected Overrides Sub OnNavigatedTo(e As Navigation.NavigationEventArgs)
    AddHandler ptm.SourceRequested, AddressOf sourceRequestHandler
End Sub

Private Sub sourceRequestHandler(
    sender As Windows.Media.PlayTo.PlayToManager,
    e As Windows.Media.PlayTo.PlayToSourceRequestedEventArgs)

    Try
        e.SourceRequest.SetSource(mediaElement.PlayToSource)
    Catch ex As Exception
        messageBlock.Text &= "Exception encountered: " & ex.Message & vbCrLf
    End Try
End Sub

Remarks

The PlayToSourceRequest class represents a user request for source media to stream to a Play To target. You use the SourceRequest property of the PlayToSourceRequestedEventArgs class to pass media from your application to Play To during the SourceRequested event.

You can use the GetDeferral method to create a deferral for when you want to make an asynchronous call to retrieve the media element to stream. Play To will then wait for you to supply the media element until you mark the deferral as complete.

For an example of how to use Play To in an application, see PlayReady DRM.

Properties

Deadline

Gets the time limit to supply the Play To source element.

Methods

DisplayErrorString(String)

Displays an error message in the Play To UI.

GetDeferral()

Defers connecting a media source to a Play To target.

SetSource(PlayToSource)

Sets the source element to connect to the Play To target.

Applies to

See also