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.
Description
Section titled “Description”Get them from Resource.getPlayback, or from a resource player node.
Times are in seconds; call the controls on the render thread.
Learn more
Section titled “Learn more”Properties
Section titled “Properties”| Property | Type | Default | Summary |
|---|---|---|---|
| loop | boolean | If true, the playback starts again at the end. | |
| autoplay | boolean | If true, the playback starts by itself once the resource is loaded. |
Methods
Section titled “Methods”| Returns | Signature | Summary |
|---|---|---|
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. |
Property details
Section titled “Property details”this loop(boolean loop)fluent abstractboolean isLoop()abstract
If true, the playback starts again at the end.
autoplay
Section titled “autoplay”this autoplay(boolean autoplay)fluent abstractboolean isAutoplay()abstract
If true, the playback starts by itself once the resource is loaded.
Method details
Section titled “Method details”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.
isPaused
Section titled “isPaused”boolean isPaused() abstract
If true, the playback is paused.
isPlaying
Section titled “isPlaying”boolean isPlaying() abstract
If true, the playback is running.
getDuration
Section titled “getDuration”double getDuration() abstract
Returns the length of the media, in seconds.
getProgress
Section titled “getProgress”double getProgress() abstract
Returns the current time on 1 of the duration.
getCurrentTime
Section titled “getCurrentTime”double getCurrentTime() abstract
Returns the current time, in seconds from the start.
restart
Section titled “restart”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
