Class WindowsSessions

java.lang.Object
lol.trq.orpheus.windows.WindowsSessions
All Implemented Interfaces:
Source, Transport

public final class WindowsSessions extends Object implements Source, Transport
The media sessions of Windows 10 (1809 and later) and Windows 11: whatever shows up in the system media overlay. One session per application.

Uses a small native library bundled in the jar. If it cannot be loaded (wrong system, blocked, missing), the source reports itself unavailable with the reason and nothing else happens. On Java 24 and later the JVM prints a warning about native access unless started with --enable-native-access=ALL-UNNAMED.

Windows gives a media kind, but browsers report everything as music, and private browser windows publish sessions too. Per-application volume is not part of this Windows interface, so volume and mute are unsupported.

  • Method Details

    • create

      public static WindowsSessions create()
    • id

      public String id()
      Description copied from interface: Source
      A short stable name, unique among the sources of one Orpheus.
      Specified by:
      id in interface Source
    • foreign

      public boolean foreign()
      Description copied from interface: Source
      Whether the sessions of this source belong to other applications and must pass the app rules. True for operating system sources, false for a program's own player.
      Specified by:
      foreign in interface Source
    • start

      public void start(SourceSink sink)
      Description copied from interface: Source
      Starts reporting to sink. Returns quickly; failures are reported as a status, not thrown.
      Specified by:
      start in interface Source
    • stop

      public void stop()
      Description copied from interface: Source
      Stops and releases every thread, handle and process. Safe to call twice and before start.
      Specified by:
      stop in interface Source
    • send

      Description copied from interface: Transport
      Sends a command. Never throws and never blocks; the future always completes.
      Specified by:
      send in interface Transport