public abstract class AbstractMedia extends Object implements AsyncMedia
MediaManager will
be descendants of this class.AsyncMedia.MediaErrorEvent, AsyncMedia.MediaErrorType, AsyncMedia.MediaException, AsyncMedia.MediaStateChangeEvent, AsyncMedia.PauseRequest, AsyncMedia.PlayRequest, AsyncMedia.StateVARIABLE_BACKGROUND_ALBUM_COVER, VARIABLE_BACKGROUND_ARTIST, VARIABLE_BACKGROUND_DURATION, VARIABLE_BACKGROUND_POSITION, VARIABLE_BACKGROUND_SUPPORTED, VARIABLE_BACKGROUND_TITLE, VARIABLE_NATIVE_CONTRLOLS_EMBEDDED| Constructor and Description |
|---|
AbstractMedia() |
| 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.
|
protected AsyncMedia.MediaErrorEvent |
fireMediaError(AsyncMedia.MediaException ex)
Fires a media error event to registered listeners.
|
protected AsyncMedia.MediaStateChangeEvent |
fireMediaStateChange(AsyncMedia.State newState)
Fires a media state change event to the registered state change listeners.
|
AsyncMedia.State |
getState()
Gets the current state of the media object.
|
void |
pause()
Pauses (actually stops) the playback or the recording of the media file
|
AsyncMedia.PauseRequest |
pauseAsync()
Initiates a pause request.
|
protected abstract void |
pauseImpl()
Initiates a pause request on the media.
|
void |
play()
Starts playing or recording the media file
|
AsyncMedia.PlayRequest |
playAsync()
Initiates a play request.
|
protected abstract void |
playImpl()
Initiates a play request on the media.
|
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.
|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcleanup, getDuration, getTime, getVariable, getVideoComponent, getVolume, isFullScreen, isNativePlayerMode, isPlaying, isVideo, prepare, setFullScreen, setNativePlayerMode, setTime, setVariable, setVolumepublic AsyncMedia.State getState()
getState in interface AsyncMediaprotected AsyncMedia.MediaStateChangeEvent fireMediaStateChange(AsyncMedia.State newState)
newState - The new statepublic void addMediaStateChangeListener(ActionListener<AsyncMedia.MediaStateChangeEvent> l)
addMediaStateChangeListener in interface AsyncMedial - Listenerpublic void removeMediaStateChangeListener(ActionListener<AsyncMedia.MediaStateChangeEvent> l)
removeMediaStateChangeListener in interface AsyncMedial - Listenerprotected AsyncMedia.MediaErrorEvent fireMediaError(AsyncMedia.MediaException ex)
ex - The MediaException to deliveraddMediaErrorListener(com.codename1.ui.events.ActionListener),
removeMediaErrorListener(com.codename1.ui.events.ActionListener)public void addMediaErrorListener(ActionListener<AsyncMedia.MediaErrorEvent> l)
addMediaErrorListener in interface AsyncMedial - Listenerpublic void removeMediaErrorListener(ActionListener<AsyncMedia.MediaErrorEvent> l)
removeMediaErrorListener in interface AsyncMedial - Listenerpublic void addMediaCompletionHandler(Runnable onComplete)
addMediaCompletionHandler in interface AsyncMediapublic AsyncMedia.PlayRequest playAsync()
playAsync in interface AsyncMediapublic AsyncMedia.PauseRequest pauseAsync()
pauseAsync in interface AsyncMediaprotected abstract void playImpl()
protected abstract void pauseImpl()
public final void play()