public interface AsyncMedia extends Media
Media
object into an AsyncMedia object using MediaManager.getAsyncMedia(com.codename1.media.Media)
.
In most cases this just casts the object to AsyncMedia, since most media returned from MediaManager
already implement
this interface. In cases where the media doesn't already implement AsyncMedia, it will return an Async wrapper around the media.MediaManager.getAsyncMedia(com.codename1.media.Media)
Modifier and Type | Interface and Description |
---|---|
static class |
AsyncMedia.MediaErrorEvent
Encapsulates a media error event.
|
static class |
AsyncMedia.MediaErrorType
Enum encapsulating the different types of media errors that can occur.
|
static class |
AsyncMedia.MediaException
Encapsulates a media exception.
|
static class |
AsyncMedia.MediaStateChangeEvent
Encapsulates a state-change event on a Media object.
|
static class |
AsyncMedia.PauseRequest
An async resource used to track the progress of a pauseAsync() request.
|
static class |
AsyncMedia.PlayRequest
An async resource used to track the progress of a playAsync() request.
|
static class |
AsyncMedia.State
An enum to represent the state of a media object.
|
VARIABLE_BACKGROUND_ALBUM_COVER, VARIABLE_BACKGROUND_ARTIST, VARIABLE_BACKGROUND_DURATION, VARIABLE_BACKGROUND_POSITION, VARIABLE_BACKGROUND_SUPPORTED, VARIABLE_BACKGROUND_TITLE, VARIABLE_NATIVE_CONTRLOLS_EMBEDDED
Modifier and Type | Method and Description |
---|---|
void |
addMediaCompletionHandler(Runnable onComplete)
Adds a callback to be run when the media has played to completion.
|
void |
addMediaErrorListener(ActionListener<AsyncMedia.MediaErrorEvent> l)
Adds a listener to be notified when an error occurs in the media.
|
void |
addMediaStateChangeListener(ActionListener<AsyncMedia.MediaStateChangeEvent> l)
Adds a listener to be notified when the state of the media changes.
|
AsyncMedia.State |
getState()
Gets the current state of the media object.
|
AsyncMedia.PauseRequest |
pauseAsync()
Initiates a pause request.
|
AsyncMedia.PlayRequest |
playAsync()
Initiates a play request.
|
void |
removeMediaErrorListener(ActionListener<AsyncMedia.MediaErrorEvent> l)
Removes a listener so that it will no longer be notified of errors.
|
void |
removeMediaStateChangeListener(ActionListener<AsyncMedia.MediaStateChangeEvent> l)
Removes a listener so that it will no longer be notified of state changes.
|
cleanup, getDuration, getTime, getVariable, getVideoComponent, getVolume, isFullScreen, isNativePlayerMode, isPlaying, isVideo, pause, play, prepare, setFullScreen, setNativePlayerMode, setTime, setVariable, setVolume
AsyncMedia.State getState()
void addMediaStateChangeListener(ActionListener<AsyncMedia.MediaStateChangeEvent> l)
l
- Listenervoid removeMediaStateChangeListener(ActionListener<AsyncMedia.MediaStateChangeEvent> l)
l
- Listenervoid addMediaErrorListener(ActionListener<AsyncMedia.MediaErrorEvent> l)
l
- Listenervoid removeMediaErrorListener(ActionListener<AsyncMedia.MediaErrorEvent> l)
l
- Listenervoid addMediaCompletionHandler(Runnable onComplete)
onComplete
- AsyncMedia.PlayRequest playAsync()
AsyncMedia.PauseRequest pauseAsync()