Class RenderStream

java.lang.Object
ke.ric.renderer.api.RenderStream
All Implemented Interfaces:
AutoCloseable

public final class RenderStream extends Object implements AutoCloseable
Lifecycle handle for a live camera feed. All configured callbacks and map/entity mutations run on the server thread. Use stop() or close() when the feed is no longer needed; owner disable also stops it. Stop removes only owned temporary output, never saved photos.

Transient queue pressure, stale evidence or unloaded required chunks can skip frames. A feed without usable evidence for one second enters NO_SIGNAL and can recover. Permanent errors end the feed and complete completion() exceptionally. Frame rate is a target, not a guarantee.

  • Method Details

    • active

      public boolean active()
      Reports whether a stop or terminal failure has been requested. This is a snapshot, not a lease that guarantees a subsequent operation will succeed.
      Returns:
      true while the feed can still produce frames
    • status

      public RenderStream.Status status()
      Returns the current output/lifecycle state. NO_SIGNAL can recover; STOPPED and FAILED are terminal.
      Returns:
      current stream status
    • lastError

      public Throwable lastError()
      Returns the latest observed error, including errors from which the stream can recover. A nonnull error alone does not imply terminal failure; inspect status() or completion().
      Returns:
      the most recent error, or null if none has occurred
    • lastFrame

      public RenderedFrame lastFrame()
      Returns the most recently published frame while active. Composite frames retain their composition reservation until replacement or stop. The frame is immutable.
      Returns:
      the latest frame, or null before first delivery and after stop
    • completion

      public CompletableFuture<Void> completion()
      Observes stream termination. Normal stop/source end completes normally; permanent failures complete exceptionally. Cancelling this future stops the stream. Ordinary future continuations have normal Java threading semantics; never wait for termination on the server thread.
      Returns:
      the stream's completion future
    • stop

      public void stop()
      Requests stop, cancels owned work and removes only this stream's temporary outputs. Idempotent and callable from any thread; Bukkit cleanup is dispatched to the server thread.
    • close

      public void close()
      Equivalent to stop().
      Specified by:
      close in interface AutoCloseable