PlayToSourceDeferral Classe

Définition

Représente une opération différée lorsque vous fournissez un élément multimédia source pour lire à.

public ref class PlayToSourceDeferral sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Deprecated("PlayToSourceDeferral 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 PlayToSourceDeferral final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Deprecated("PlayToSourceDeferral may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.Foundation.UniversalApiContract")]
class PlayToSourceDeferral final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Deprecated("PlayToSourceDeferral 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 PlayToSourceDeferral
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Deprecated("PlayToSourceDeferral may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.Foundation.UniversalApiContract")]
public sealed class PlayToSourceDeferral
Public NotInheritable Class PlayToSourceDeferral
Héritage
Object Platform::Object IInspectable PlayToSourceDeferral
Attributs

Configuration requise pour Windows

Famille d’appareils
Windows 10 (introduit dans 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduit dans v1.0)

Exemples

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

Remarques

Vous pouvez utiliser un report lorsque vous souhaitez effectuer un appel asynchrone pour récupérer l’élément multimédia à diffuser en continu. La lecture à attend ensuite que vous fournissez l’élément multimédia jusqu’à ce que vous marquez le report comme terminé.

Pour créer un report, appelez la méthode GetDeferral pour indiquer à la classe PlayToManager d’attendre de recevoir un élément multimédia source à diffuser en continu vers la cible Lire à. Une fois que vous avez fourni l’élément multimédia source à la méthode SetSource , appelez la méthode Complete pour mettre fin au report. Si vous créez un report et que le temps d’attente dépasse la propriété Deadline , la lecture à continue sans élément source de votre application.

Pour obtenir un exemple d’utilisation de Play To dans une application, consultez PlayReady DRM.

Méthodes

Complete()

Met fin au report.

S’applique à

Voir aussi