PlayToSourceDeferral class

Applies to Windows only

Represents a deferred operation when you're supplying a source media element for Play To.

Syntax


public sealed class PlayToSourceDeferral

Attributes

[MarshalingBehavior(Agile)]
[Version(0x06020000)]

Members

The PlayToSourceDeferral class has these types of members:

Methods

The PlayToSourceDeferral class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

MethodDescription
Complete Ends the deferral.

 

Remarks

You can use a deferral when you want to make an asynchronous call to retrieve the media element to stream. Play To will then wait for you to supply the media element until you mark the deferral as complete.

To create a deferral, call the GetDeferral method to instruct the PlayToManagerclass to wait to receive a source media element to stream to the Play To target. After you've supplied the source media element to the SetSource method, call the Complete method to end the deferral. If you create a deferral and the wait time exceeds the Deadline property, Play To will continue without a source element from your app.

For an example of how to use Play To in an application, see Quickstart: Using Play To in applications (JavaScript) or Quickstart: Using Play To in applications (C#/VB).

Examples


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();
}


Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

None supported

Namespace

Windows.Media.PlayTo
Windows::Media::PlayTo [C++]

Metadata

Windows.winmd

See also

Samples
Play To sample
PlayToReceiver sample
Media Server sample

 

 

Show:
© 2014 Microsoft. All rights reserved.