Class ClipPlayback

java.lang.Object
com.hypixel.hytale.server.core.modules.voice.ClipPlayback

public final class ClipPlayback extends Object
Handle for a clip queued via VoiceSpeaker.play(List). The voice module paces the clip's frames one per 20Lms so the client jitter buffer is not overrun. Use cancel() to stop early and completion to chain follow-up work or clean up.
  • Method Details

    • cancel

      public void cancel()
      Stops the clip and resolves completion exceptionally with a CancellationException. Frames already handed to the speaker may still play out on the client. Idempotent; a clip that already finished is unaffected.
    • isDone

      public boolean isDone()
      Whether the clip has reached a terminal state: all frames pushed, the speaker closed, cancelled, or dropped after an error.
    • completion

      @Nonnull public CompletionStage<Void> completion()
      Completes when the final frame has been queued to the client (not when client-side playback ends), or when the speaker closes first. Completes exceptionally if cancel() runs first or the clip is dropped after an error; observe it with CompletionStage.whenComplete(BiConsumer) or CompletionStage.exceptionally(Function) (the cancel cause is a CancellationException, delivered per the CompletionStage convention). Continuations run on an unspecified server thread, may run synchronously on the thread that completes or cancels the clip, and so must not block. The returned stage cannot be completed or cancelled by callers; use cancel().