Click or drag to resize

IMediaReceiversRetrieveAsync Method (PredicateIMediaReceiver)

Waiting till the first receiver matching the predicate is discovered.

Namespace:  DotNetBrowser.Cast
Assembly:  DotNetBrowser (in DotNetBrowser.dll) Version: 2.27.5
Syntax
C#
Task<IMediaReceiver> RetrieveAsync(
	Predicate<IMediaReceiver> predicate
)

Parameters

predicate
Type: SystemPredicateIMediaReceiver
The predicated media receiver.

Return Value

Type: TaskIMediaReceiver
The task that can be used to wait for completion and obtain the result with the first discovered receiver matching the predicate.
Exceptions
ExceptionCondition
ReceiverNotDiscoveredException When the receiver has not been discovered within 45 seconds.
Remarks

If a matching receiver has already been discovered, returns it immediately.

Example of usage:

browser.Cast.StartPresentationHandler =
    new AsyncHandler<StartPresentationParameters, StartPresentationResponse>(async p =>
    {
        IMediaReceiver mediaReceiver
            = await p.MediaReceivers
                     .RetrieveAsync(receiver => receiver.Name.Contains("Samsung TV"));
        return StartPresentationResponse.Start(mediaReceiver);
    });
See Also