PlayToSourceRequest 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
表示使用 Play To 目標連接媒體元素的要求。
public ref class PlayToSourceRequest sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Deprecated("PlayToSourceRequest 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 PlayToSourceRequest final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Deprecated("PlayToSourceRequest may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.Foundation.UniversalApiContract")]
class PlayToSourceRequest final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Deprecated("PlayToSourceRequest 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 PlayToSourceRequest
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Deprecated("PlayToSourceRequest may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.Foundation.UniversalApiContract")]
public sealed class PlayToSourceRequest
Public NotInheritable Class PlayToSourceRequest
- 繼承
- 屬性
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
備註
PlayToSourceRequest 類別代表將來源媒體串流至播放目標的使用者要求。 您可以使用 PlayToSourceRequestedEventArgs 類別的 SourceRequest 屬性,在 SourceRequested 事件期間將媒體從您的應用程式傳遞至 Play To。
當您想要進行異步呼叫以擷取要串流的媒體元素時,您可以使用 GetDeferral 方法來建立延遲。 [播放到] 會等到您提供媒體元素,直到您將延遲標示為完成為止。
如需如何在應用程式中使用 Play To 的範例,請參閱 PlayReady DRM。
屬性
Deadline |
取得提供播放至來源元素的時間限制。 |
方法
DisplayErrorString(String) |
在播放至 UI 中顯示錯誤訊息。 |
GetDeferral() |
延遲將媒體來源連線至播放目標。 |
SetSource(PlayToSource) |
設定要連線到播放至目標的來源元素。 |