Windows.​Media.​Play​To Windows.​Media.​Play​To Windows.​Media.​Play​To Namespace

Supports the streaming of audio, video, and images to remote devices.

Classes

CurrentTimeChangeRequestedEventArgs CurrentTimeChangeRequestedEventArgs CurrentTimeChangeRequestedEventArgs

Provides information about the CurrentTimeChangeRequested event.

MuteChangeRequestedEventArgs MuteChangeRequestedEventArgs MuteChangeRequestedEventArgs

Provides information about the MuteChangeRequested event.

PlaybackRateChangeRequestedEventArgs PlaybackRateChangeRequestedEventArgs PlaybackRateChangeRequestedEventArgs

Provides information about the PlaybackRateChangeRequested event.

PlayToConnection PlayToConnection PlayToConnection

Provides information about a Play To connection.

PlayToConnectionErrorEventArgs PlayToConnectionErrorEventArgs PlayToConnectionErrorEventArgs

Provides information about the Error event.

PlayToConnectionStateChangedEventArgs PlayToConnectionStateChangedEventArgs PlayToConnectionStateChangedEventArgs

Provides information about the StateChanged event.

PlayToConnectionTransferredEventArgs PlayToConnectionTransferredEventArgs PlayToConnectionTransferredEventArgs

Provides information about the Transferred event.

PlayToManager PlayToManager PlayToManager

Provides access to Play To capabilities.

PlayToReceiver PlayToReceiver PlayToReceiver

Represents a Play To target.

PlayToSource PlayToSource PlayToSource

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

PlayToSourceDeferral PlayToSourceDeferral PlayToSourceDeferral

Represents a deferred operation when you're supplying a source media element for Play To.

PlayToSourceRequest PlayToSourceRequest PlayToSourceRequest

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

PlayToSourceRequestedEventArgs PlayToSourceRequestedEventArgs PlayToSourceRequestedEventArgs

Provides information about the SourceRequested event.

PlayToSourceSelectedEventArgs PlayToSourceSelectedEventArgs PlayToSourceSelectedEventArgs

Provides information about the SourceSelected event.

SourceChangeRequestedEventArgs SourceChangeRequestedEventArgs SourceChangeRequestedEventArgs

Provides information about the SourceChangeRequested event.

VolumeChangeRequestedEventArgs VolumeChangeRequestedEventArgs VolumeChangeRequestedEventArgs

Provides information about the VolumeChangeRequested event.

Enums

PlayToConnectionError PlayToConnectionError PlayToConnectionError

Describes an error on a Play To connection.

PlayToConnectionState PlayToConnectionState PlayToConnectionState

Describes the status of a Play To connection.

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

Remarks

You can use Play To to enable users to easily stream audio, video, or images from their computer to devices in their home network. For example, a user who's watching a video in your application can stream that video to his or her TV so that everyone in the room view it.

Play To streams audio, video, or images to a certified Play To receiver.

Play To is part of the Devices charm. For applications that contain audio, video, or images, users open the Devices charm to select devices from their home network that they can stream the media content to.

To enable Play To in your application, register for the SourceRequested event. To register for the SourceRequested event, get a reference to the current PlayToManager class by calling the GetForCurrentView method. You can then call addEventHandler on the PlayToManager class to associate your event handler with the SourceRequested event. In your event handler, pass the media element from your application to the SetSource method of the PlayToSourceRequestedEventArgs object that was passed to the event handler.

When a user selects a Play To target from the Devices charm, Play To fires the SourceRequested event. Play To then streams the media element that was passed to the SetSource method to the target device that the user has selected.

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