-api-id | -api-type |
---|---|
T:Windows.Media.PlayTo.PlayToReceiver |
winrt class |
Represents a Play To target.
You can use the PlayToReceiver class to create a custom software Play To receiver that is a digital media renderer for computers on your network. You can include a PlayToReceiver object in your app to handle communication with Play To client computers, and then play or display content streamed from those computers using your own media elements or controls.
The members of the PlayToReceiver class consist of the following:
- The FriendlyName property that identifies the name of the Play To receiver when it is advertised on the network.
- Properties that identify the type of media that your Play To receiver supports: SupportsAudio, SupportsVideo, SupportsImage.
- The StartAsync method that starts the Play To receiver and advertises it on the network as a digital media renderer. The StopAsync method that stops the Play To receiver and stops advertising it on the network.
- The SourceChangeRequested event that occurs when you receive a media stream from a computer, and events that occur when an action is requested by the Play To client computer such as a volume change, or a change in the playback location of the streamed media: CurrentTimeChangeRequested, MuteChangeRequested, PauseRequested, PlayRequested, StopRequested, VolumeChangeRequested, TimeUpdateRequested.
- Methods that you can call to notify the Play To client when a change occurs for your Play To receiver: NotifyDurationChange, NotifyEnded, NotifyError, NotifyLoadedMetadata, NotifyPaused, NotifyPlaying, NotifyRateChange, NotifySeeked, NotifySeeking, NotifyStopped, NotifyTimeUpdate, NotifyVolumeChange.
In Play To, video starts from the current position. If you want to start the video from the beginning, simply seek to the beginning of the video as soon as the Play To connection is established.
For an example of creating a software Play To receiver, see Media casting.
[!code-csharpStartAndStop]
[!code-vbStartAndStop]
PlayTo apps will not be suspended as long as video or music is playing on the Play To receiver or images are continuously sent to the Play To receiver. Apps have approximately 10 seconds to send a new image after the current one is displayed and approximately 10 seconds to send the next audio or video after the current one has ended.
Note
This class is not agile, which means that you need to consider its threading model and marshaling behavior. For more info, see Threading and Marshaling (C++/CX) and Using Windows Runtime objects in a multithreaded environment (.NET).
Play To sample, PlayToReceiver sample, Media Server sample
privateNetworkClientServer