Delen via


MediaElement.PlayToPreferredSourceUri Property

Definition

Note

PlayToPreferredSourceUri is deprecated. Instead, call MediaElement.GetAsCastingSource and, on the returned value, call CastingSource.PreferredSourceUri.

Gets or sets the path to the preferred media source which enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server.

public:
 property Uri ^ PlayToPreferredSourceUri { Uri ^ get(); void set(Uri ^ value); };
/// [get: Windows.Foundation.Metadata.Deprecated("PlayToPreferredSourceUri may be altered or unavailable for releases after Windows 10.0. Instead, use GetAsCastingSource().PreferredSourceUri.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, Windows.Foundation.UniversalApiContract)]
/// [set: Windows.Foundation.Metadata.Deprecated("PlayToPreferredSourceUri may be altered or unavailable for releases after Windows 10.0. Instead, use GetAsCastingSource().PreferredSourceUri.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, Windows.Foundation.UniversalApiContract)]
Uri PlayToPreferredSourceUri();

void PlayToPreferredSourceUri(Uri value);
/// [get: Windows.Foundation.Metadata.Deprecated("PlayToPreferredSourceUri may be altered or unavailable for releases after Windows 10.0. Instead, use GetAsCastingSource().PreferredSourceUri.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.Foundation.UniversalApiContract")]
/// [set: Windows.Foundation.Metadata.Deprecated("PlayToPreferredSourceUri may be altered or unavailable for releases after Windows 10.0. Instead, use GetAsCastingSource().PreferredSourceUri.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.Foundation.UniversalApiContract")]
Uri PlayToPreferredSourceUri();

void PlayToPreferredSourceUri(Uri value);
public System.Uri PlayToPreferredSourceUri { [Windows.Foundation.Metadata.Deprecated("PlayToPreferredSourceUri may be altered or unavailable for releases after Windows 10.0. Instead, use GetAsCastingSource().PreferredSourceUri.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, typeof(Windows.Foundation.UniversalApiContract))] get; [Windows.Foundation.Metadata.Deprecated("PlayToPreferredSourceUri may be altered or unavailable for releases after Windows 10.0. Instead, use GetAsCastingSource().PreferredSourceUri.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, typeof(Windows.Foundation.UniversalApiContract))] set; }
public System.Uri PlayToPreferredSourceUri { [Windows.Foundation.Metadata.Deprecated("PlayToPreferredSourceUri may be altered or unavailable for releases after Windows 10.0. Instead, use GetAsCastingSource().PreferredSourceUri.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.Foundation.UniversalApiContract")] get; [Windows.Foundation.Metadata.Deprecated("PlayToPreferredSourceUri may be altered or unavailable for releases after Windows 10.0. Instead, use GetAsCastingSource().PreferredSourceUri.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.Foundation.UniversalApiContract")] set; }
var uri = mediaElement.playToPreferredSourceUri;
mediaElement.playToPreferredSourceUri = uri;
Public Property PlayToPreferredSourceUri As Uri
<MediaElement PlayToPreferredSourceUri="uri" />

Property Value

The path to the preferred media source.

Attributes

Examples

Here is some code that shows how to set up Play To by reference.

<MediaElement Source="http://www.contoso.com/videos/video.mp4" 
   PlayToPreferredSourceUri="http://www.contoso.com/catalogid=1234">
</MediaElement>
MediaElement video = new MediaElement();

video.Source = 
    new Uri("http://www.contoso.com/videos/video.mp4");

video.PlayToPreferredSourceUri = 
    new Uri("http://www.contoso.com/catalogid=1234"); 
auto video = ref new Windows::UI::Xaml::Controls::MediaElement();

video->Source = 
   ref new Windows::Foundation::Uri("http://www.contoso.com/videos/video.mp4");

video->PlayToPreferredSourceUri = 
   ref new Windows::Foundation::Uri("http://www.contoso.com/catalogid=1234");

Remarks

PlayToSource.PreferredSourceUri enables Play To by reference. This allows streaming content on the Play To target device from a different location, such as a cloud media server. This enables web pages and UWP app to play Digital Rights Management (DRM) protected content. The app specifies a preferred Uniform Resource Identifier (URI) that will be sent to the Play To target device. This Uniform Resource Identifier (URI) can point to a cloud based media server. If the PlayToSource.PreferredSourceUri value is present, the Play To target device can stream content directly from the cloud, which can be Digital Rights Management (DRM) protected, instead of streaming content from the Windows machine which must be unprotected content.

A forward slash ("/") is appended to the Uniform Resource Identifier (URI) string when it is sent over the network to a Play To device. This is done to conform to Uniform Resource Identifier (URI) standards.

Applies to