PlayToManager.SourceRequested | sourcerequested event

This topic has not yet been rated - Rate this topic

Occurs when a user requests media to stream to a Play To target device.

Syntax


function onSourceRequested(eventArgs) { /* Your code */ }
 
// addEventListener syntax
playToManager.addEventListener("sourcerequested", onSourceRequested);
playToManager.removeEventListener("sourcerequested", onSourceRequested);
 
- or -

playToManager.onsourcerequested = onSourceRequested;


Event information

Delegate TypedEventHandler(PlayToManager, PlayToSourceRequestedEventArgs)

Remarks

The SourceRequested event is fired when a user selects the Devices charm in a Play To–enabled application. You supply the audio, video, or image that Play To will stream to a target device during the SourceRequested event.

If you do not supply a media source within 200 milliseconds, the SourceRequested event will time out and the Devices charm will not display any Play To targets for your app.

The SourceRequested event occurs before the user selects the target device. After the user has selected the target device, the SourceSelected event is fired. If the user exits the Devices charm without selecting a target device, the SourceSelected event isn't fired.

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


// Play To Contract

var ptm = Windows.Media.PlayTo.PlayToManager.getForCurrentView();
ptm.addEventListener("sourcerequested", sourceRequestHandler, false);

function sourceRequestHandler(e) {
    try {
        e.sourceRequest.setSource(mediaElement.msPlayToSource);

    } catch (ex) {
        id("messageDiv").innerHTML += "Exception encountered: " + ex.message + "<br/>";
    }
}


Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Namespace

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

Metadata

Windows.winmd

See also

PlayToManager
Samples
Play To sample
PlayToReceiver sample
Media Server sample

 

 

Build date: 12/4/2012

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.