Record Class Playback

java.lang.Object
java.lang.Record
lol.trq.orpheus.Playback
Record Components:
sourceId - the source the session came from
sessionId - the session inside that source
app - the application behind the session
track - what is playing
state - the playback state
timeline - where playback is and how it advances
shuffle - shuffle mode
repeat - repeat mode
volume - 0 to 1, or NaN when the source does not report it
controls - the commands that work right now
coverKey - the key of the cover image, or null when there is none
coverUri - a remote cover location the library did not fetch, or null
shareable - whether the caller opted in to passing this data on to other people
display - rules attached by the source

public record Playback(String sourceId, String sessionId, SourceApp app, Track track, PlaybackState state, Timeline timeline, Shuffle shuffle, Repeat repeat, double volume, Set<Control> controls, String coverKey, String coverUri, boolean shareable, DisplayRules display) extends Record
What one session is playing at one instant. Immutable; a new one replaces it on every change.
  • Field Details

    • NONE

      public static final Playback NONE
      The snapshot when nothing is selected.
  • Constructor Details

    • Playback

      public Playback(String sourceId, String sessionId, SourceApp app, Track track, PlaybackState state, Timeline timeline, Shuffle shuffle, Repeat repeat, double volume, Set<Control> controls, String coverKey, String coverUri, boolean shareable, DisplayRules display)
      Creates an instance of a Playback record class.
      Parameters:
      sourceId - the value for the sourceId record component
      sessionId - the value for the sessionId record component
      app - the value for the app record component
      track - the value for the track record component
      state - the value for the state record component
      timeline - the value for the timeline record component
      shuffle - the value for the shuffle record component
      repeat - the value for the repeat record component
      volume - the value for the volume record component
      controls - the value for the controls record component
      coverKey - the value for the coverKey record component
      coverUri - the value for the coverUri record component
      shareable - the value for the shareable record component
      display - the value for the display record component
  • Method Details

    • isPresent

      public boolean isPresent()
    • playing

      public boolean playing()
    • can

      public boolean can(Control control)
      Whether control works for this session right now.
    • sameSession

      public boolean sameSession(Playback other)
      Whether this snapshot and other describe the same session.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • sourceId

      public String sourceId()
      Returns the value of the sourceId record component.
      Returns:
      the value of the sourceId record component
    • sessionId

      public String sessionId()
      Returns the value of the sessionId record component.
      Returns:
      the value of the sessionId record component
    • app

      public SourceApp app()
      Returns the value of the app record component.
      Returns:
      the value of the app record component
    • track

      public Track track()
      Returns the value of the track record component.
      Returns:
      the value of the track record component
    • state

      public PlaybackState state()
      Returns the value of the state record component.
      Returns:
      the value of the state record component
    • timeline

      public Timeline timeline()
      Returns the value of the timeline record component.
      Returns:
      the value of the timeline record component
    • shuffle

      public Shuffle shuffle()
      Returns the value of the shuffle record component.
      Returns:
      the value of the shuffle record component
    • repeat

      public Repeat repeat()
      Returns the value of the repeat record component.
      Returns:
      the value of the repeat record component
    • volume

      public double volume()
      Returns the value of the volume record component.
      Returns:
      the value of the volume record component
    • controls

      public Set<Control> controls()
      Returns the value of the controls record component.
      Returns:
      the value of the controls record component
    • coverKey

      public String coverKey()
      Returns the value of the coverKey record component.
      Returns:
      the value of the coverKey record component
    • coverUri

      public String coverUri()
      Returns the value of the coverUri record component.
      Returns:
      the value of the coverUri record component
    • shareable

      public boolean shareable()
      Returns the value of the shareable record component.
      Returns:
      the value of the shareable record component
    • display

      public DisplayRules display()
      Returns the value of the display record component.
      Returns:
      the value of the display record component