Interface MediaSource

All Known Subinterfaces:
PresentationRequest

public interface MediaSource
A media source that is supported by a media receiver.
Since:
7.34
  • Method Summary

    Static Methods
    Modifier and Type
    Method
    Description
    Returns a media source that represents any browser's content.
    Returns a media source that represents any screen's content.
  • Method Details

    • browser

      static MediaSource 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

      static MediaSource 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);
               }
           });