PlayToSourceRequestedEventArgs PlayToSourceRequestedEventArgs PlayToSourceRequestedEventArgs PlayToSourceRequestedEventArgs Class

Definition

Provides information about the SourceRequested event.

public sealed class PlayToSourceRequestedEventArgspublic sealed class PlayToSourceRequestedEventArgsPublic NotInheritable Class PlayToSourceRequestedEventArgspublic sealed class PlayToSourceRequestedEventArgs
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

You use the SourceRequest property of the class to pass media from your application to Play To during the SourceRequested event.

For an example of how to use Play To in an application, see Quickstart: Using Play To in applications (JavaScript) or PlayReady DRM.

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

var ptm = Windows.Media.PlayTo.PlayToManager.getForCurrentView();
ptm.addEventListener("sourcerequested", sourceRequestHandler, false);

function sourceRequestHandler(e) {
    try {
        e.sourceRequest.setSource(mediaElement.msPlayToSource);

    } catch (ex) {
        id("messageDiv").innerHTML += "Exception encountered: " + ex.message + "<br/>";
    }
}
' 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

Properties

SourceRequest SourceRequest SourceRequest SourceRequest

Gets the media object to connect to a Play To target.

public PlayToSourceRequest SourceRequest { get; }public PlayToSourceRequest SourceRequest { get; }Public ReadOnly Property SourceRequest As PlayToSourceRequestpublic PlayToSourceRequest SourceRequest { get; }
Value
PlayToSourceRequest PlayToSourceRequest PlayToSourceRequest PlayToSourceRequest

The media object to connect to a Play To target.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

You use the property to pass media from your application to Play To during the SourceRequested event.