PlayToSourceRequest.GetDeferral Metodo
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Defer che connette un'origine multimediale a una destinazione Play To.
public:
virtual PlayToSourceDeferral ^ GetDeferral() = GetDeferral;
/// [Windows.Foundation.Metadata.Deprecated("PlayToSourceRequest may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, Windows.Foundation.UniversalApiContract)]
PlayToSourceDeferral GetDeferral();
/// [Windows.Foundation.Metadata.Deprecated("PlayToSourceRequest may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.Foundation.UniversalApiContract")]
PlayToSourceDeferral GetDeferral();
[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))]
public PlayToSourceDeferral GetDeferral();
[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 PlayToSourceDeferral GetDeferral();
function getDeferral()
Public Function GetDeferral () As PlayToSourceDeferral
Restituisce
Oggetto rinvio che è possibile usare per identificare quando viene completato il rinvio.
- Attributi
Esempio
private Windows.Media.PlayTo.PlayToManager ptm =
Windows.Media.PlayTo.PlayToManager.GetForCurrentView();
protected override void OnNavigatedTo(NavigationEventArgs e)
{
ptm.SourceRequested += sourceRequestHandlerDeferred;
}
async private void sourceRequestHandlerDeferred(
Windows.Media.PlayTo.PlayToManager sender,
Windows.Media.PlayTo.PlayToSourceRequestedEventArgs e)
{
var deferral = e.SourceRequest.GetDeferral();
// Async call to get source media
var element = await getMediaElementAsync();
e.SourceRequest.SetSource(element.PlayToSource);
deferral.Complete();
}
Private ptm As Windows.Media.PlayTo.PlayToManager =
Windows.Media.PlayTo.PlayToManager.GetForCurrentView()
Protected Overrides Sub OnNavigatedTo(e As Navigation.NavigationEventArgs)
AddHandler ptm.SourceRequested, AddressOf sourceRequestHandlerDeferred
End Sub
Private Async Sub sourceRequestHandlerDeferred(
sender As Windows.Media.PlayTo.PlayToManager,
e As Windows.Media.PlayTo.PlayToSourceRequestedEventArgs)
Dim deferral = e.SourceRequest.GetDeferral()
' Async call to get source media
Dim element = Await getMediaElementAsync()
e.SourceRequest.SetSource(element.PlayToSource)
deferral.Complete()
End Sub
Commenti
È possibile usare un rinvio quando si vuole effettuare una chiamata asincrona per recuperare l'elemento multimediale da trasmettere. Play To attenderà quindi di fornire l'elemento multimediale fino a quando non si contrassegna il rinvio come completato.
Per creare un rinvio, chiamare il metodo GetDeferral per indicare alla classe PlayToManager di attendere di ricevere un elemento multimediale di origine per trasmettere alla destinazione Play To. Dopo aver fornito l'elemento multimediale di origine al metodo SetSource , chiamare il metodo Complete per terminare il rinvio. Se si crea un rinvio e il tempo di attesa supera la proprietà Deadline , Play To continuerà senza un elemento di origine dall'app.
Per un esempio di come usare Play To in un'applicazione, vedere PlayReady DRM.