Interface CastSession

All Superinterfaces:
Observable<CastSessionStopped>

public interface CastSession extends Observable<CastSessionStopped>
A session of casting media content to a media receiver.

The session is discovered when the user starts casting the browser/screen content or a presentation of media content via the JxBrowser API, or another application, i.e. Google Chrome. To indicate that the cast session has been started by another profile and, accordingly, a Chromium instance the isLocal() method is provided.

Since:
7.29
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the description of the session.
    boolean
    Returns true if the session is alive.
    boolean
    Returns true if the cast session is initiated and managed by the current profile.
    Returns the media receiver of this session.
    Returns the mode of the session.
    Returns the profile that discovered this cast session.
    void
    Stops this cast session.

    Methods inherited from interface com.teamdev.jxbrowser.event.Observable

    on
  • Method Details

    • mediaReceiver

      MediaReceiver mediaReceiver()
      Returns the media receiver of this session.

      The method may block the current thread if the receiver is not discovered yet. It may happen when the cast session is not isLocal() local} and started on the receiver not yet discovered by the current instance of Chromium.

      Throws:
      ObjectClosedException - when the profile is deleted or its engine is closed
      ReceiverNotDiscoveredException - when the receiver has not been discovered within 45 seconds
    • mode

      CastMode mode()
      Returns the mode of the session.
      Throws:
      ObjectClosedException - when the profile is deleted or its engine is closed
    • description

      String description()
      Returns the description of the session. Examples: "Mirroring tab (www.example.com)", "Casting media", "Casting YouTube".

      The description may be empty when the session just started and Chromium didn't define the cast content yet.

      Throws:
      ObjectClosedException - when the profile is deleted or its engine is closed
    • stop

      void stop()
      Stops this cast session.

      Does nothing if the cast session is already stopped.

      Throws:
      ObjectClosedException - when the profile is deleted or its engine is closed
    • isAlive

      boolean isAlive()
      Returns true if the session is alive.
      Throws:
      ObjectClosedException - when the profile is deleted or its engine is closed
    • isLocal

      boolean isLocal()
      Returns true if the cast session is initiated and managed by the current profile.
      Throws:
      ObjectClosedException - when the profile is deleted or its engine is closed
    • profile

      Profile profile()
      Returns the profile that discovered this cast session.

      If the session is not local then this is not the profile that started the session.