public interface MediaSource
Modifier and Type | Method and Description |
---|---|
static MediaSource |
browser()
Returns a media source that represents any browser's content.
|
static MediaSource |
screen()
Returns a media source that represents any screen's content.
|
static MediaSource browser()
MediaReceivers mediaReceivers = browser.profile().mediaCasting().mediaReceivers();
Optional<MediaReceiver> mediaReceiver =
mediaReceivers.list()
.stream()
.filter(it -> it.name().startsWith("Samsung TV"))
.findAny();
mediaReceiver.ifPresent(samsungTv -> {
if (samsungTv.supports(MediaSource.browser())) {
browser.cast(samsungTv);
}
});
static MediaSource screen()
Example of usage:
MediaReceivers mediaReceivers = browser.profile().mediaCasting().mediaReceivers();
Optional<MediaReceiver> mediaReceiver =
mediaReceivers.list()
.stream()
.filter(it -> it.name().startsWith("Samsung TV"))
.findAny();
mediaReceiver.ifPresent(samsungTv -> {
if (samsungTv.supports(MediaSource.screen())) {
browser.castScreen(samsungTv);
}
});