Skip to content

IResourcePlayback

interface IResourcePlayback
Known subtypes: AnimatedResourceDecoder, VideoResourceDecoder
Package: dev.joid.lib.resource.playback · Module: core · Source: IResourcePlayback.java

The playback controls of an animated image or a video, to play, pause, seek and loop it.

Get them from Resource.getPlayback, or from a resource player node. Times are in seconds; call the controls on the render thread.

PropertyTypeDefaultSummary
loopbooleanIf true, the playback starts again at the end.
autoplaybooleanIf true, the playback starts by itself once the resource is loaded.

ReturnsSignatureSummary
thisplay() fluent abstractStarts the playback from the start, or from the time of a seek made while stopped, or resumes it after pause().
thisstop() fluent abstractStops the playback; the next play() starts from the start, unless a seek comes first.
thispause() fluent abstractPauses the playback at the current time.
thisseek(double seconds) fluent abstractMoves the playback to seconds from the start; while stopped, the playback pauses on that frame, and the next play() starts there.
booleanisPaused() abstractIf true, the playback is paused.
booleanisPlaying() abstractIf true, the playback is running.
doublegetDuration() abstractReturns the length of the media, in seconds.
doublegetProgress() abstractReturns the current time on 1 of the duration.
doublegetCurrentTime() abstractReturns the current time, in seconds from the start.
thisrestart() fluent defaultStops, seeks to the start and plays.

  • this loop(boolean loop) fluent abstract
  • boolean isLoop() abstract

If true, the playback starts again at the end.

  • this autoplay(boolean autoplay) fluent abstract
  • boolean isAutoplay() abstract

If true, the playback starts by itself once the resource is loaded.

this play() fluent abstract

Starts the playback from the start, or from the time of a seek made while stopped, or resumes it after pause().

this stop() fluent abstract

Stops the playback; the next play() starts from the start, unless a seek comes first.

this pause() fluent abstract

Pauses the playback at the current time.

this seek(double seconds) fluent abstract

Moves the playback to seconds from the start; while stopped, the playback pauses on that frame, and the next play() starts there.

boolean isPaused() abstract

If true, the playback is paused.

boolean isPlaying() abstract

If true, the playback is running.

double getDuration() abstract

Returns the length of the media, in seconds.

double getProgress() abstract

Returns the current time on 1 of the duration.

double getCurrentTime() abstract

Returns the current time, in seconds from the start.

this restart() fluent default

Stops, seeks to the start and plays.


fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses

Report a problem with this page