Package com.teamdev.jxbrowser.cast
Interface MediaSource
- All Known Subinterfaces:
PresentationRequest
public interface MediaSource
A media source that is supported by
a media receiver.
- Since:
- 7.34
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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.
-
Method Details
-
browser
Returns a media source that represents any browser's content.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); } });
-
screen
Returns a media source that represents any screen's content.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); } });
-