PlayToManager 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
提供对“播放到”功能的访问权限。
public ref class PlayToManager sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Deprecated("PlayToManager 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 PlayToManager final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Deprecated("PlayToManager may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.Foundation.UniversalApiContract")]
class PlayToManager final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Deprecated("PlayToManager 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 PlayToManager
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Deprecated("PlayToManager may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.Foundation.UniversalApiContract")]
public sealed class PlayToManager
Public NotInheritable Class PlayToManager
- 继承
- 属性
Windows 要求
设备系列 |
Windows 10 (在 10.0.10240.0 中引入)
|
API contract |
Windows.Foundation.UniversalApiContract (在 v1.0 中引入)
|
示例
// 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
注解
如果应用程序包含音频、视频或图像元素,用户可以将这些元素的媒体源流式传输到“播放到”目标设备。 可以使用 PlayToManager 类为用户自定义“播放到”体验。 可以使用 DefaultSourceSelection 属性禁用默认行为。可以使用 SourceRequested 事件选择流式传输的媒体。 并且可以使用 ShowPlayToUI 方法显示“播放到”UI 来代替“设备”超级按钮。
在“播放到”中,视频从当前位置开始。 如果要从头开始视频,只需在建立“播放到”连接后立即查找视频的开头。
只要在“播放到”接收器上播放视频或音乐,或者图像持续发送到“播放到”接收器,PlayTo 应用就不会暂停。 应用在显示当前图像后有大约 10 秒的时间发送新图像,在当前图像结束后发送下一个音频或视频大约需要 10 秒。
有关如何在应用程序中使用“播放到”的示例,请参阅 PlayReady DRM。
属性
DefaultSourceSelection |
启用或禁用“播放到”的默认源选择。 |
方法
GetForCurrentView() |
获取当前视图的“播放到”管理器。 |
ShowPlayToUI() |
显示“播放到”UI。 |
事件
SourceRequested |
当用户请求媒体流式传输到“播放到”目标设备时发生。 |
SourceSelected |
选择“播放到”源元素时发生。 |