Class MacNowPlaying

java.lang.Object
lol.trq.orpheus.macos.MacNowPlaying
All Implemented Interfaces:
Source, Transport

@Experimental public final class MacNowPlaying extends Object implements Source, Transport
What macOS shows as "Now Playing". Only the one application the system has elected is visible.

macOS has no public interface for this. The data comes from a helper, mediaremote-adapter (BSD-3-Clause, bundled in the jar), which this source runs as a child process through the system's /usr/bin/perl. It rests on a private part of macOS, so any system update can stop it working; the source then reports itself unavailable and nothing else happens. Commands go to the elected application and are sent by short-lived child processes.

  • Method Details

    • create

      public static MacNowPlaying create()
    • create

      public static MacNowPlaying create(Path adapterDirectory)
      Uses a helper you built yourself instead of the bundled one.
      Parameters:
      adapterDirectory - a directory holding mediaremote-adapter.pl and MediaRemoteAdapter.framework
    • 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