public abstract class AbstractMedia
- Object
- AbstractMedia
ImplementsAsyncMedia, Media
An abstract base class for AsyncMedia. Most media returned from
MediaManager will
be descendants of this class.Constructors
public AbstractMedia() |
Methods
Inherited nested types
Inherited fields
Inherited methods
Constructor details
AbstractMedia
public AbstractMedia()Method details
getState
public AsyncMedia.State getState()Gets the current state of the media object.
Returns
The state of the media object.
fireMediaStateChange
protected AsyncMedia.MediaStateChangeEvent fireMediaStateChange(AsyncMedia.State newState)Fires a media state change event to the registered state change listeners.
Parameters
newStateAsyncMedia.State- The new state
Returns
The state change event.
addMediaStateChangeListener
public void addMediaStateChangeListener(ActionListener<AsyncMedia.MediaStateChangeEvent> l)Adds a listener to be notified when the state of the media changes.
Parameters
lActionListener<AsyncMedia.MediaStateChangeEvent>- Listener
removeMediaStateChangeListener
public void removeMediaStateChangeListener(ActionListener<AsyncMedia.MediaStateChangeEvent> l)Removes a listener so that it will no longer be notified of state changes.
Parameters
lActionListener<AsyncMedia.MediaStateChangeEvent>- Listener
fireMediaError
protected AsyncMedia.MediaErrorEvent fireMediaError(AsyncMedia.MediaException ex)Fires a media error event to registered listeners.
Parameters
exAsyncMedia.MediaException- The MediaException to deliver
Returns
The MediaErrorEvent object sent to listeners.
addMediaErrorListener
public void addMediaErrorListener(ActionListener<AsyncMedia.MediaErrorEvent> l)Adds a listener to be notified when an error occurs in the media.
Parameters
lActionListener<AsyncMedia.MediaErrorEvent>- Listener
removeMediaErrorListener
public void removeMediaErrorListener(ActionListener<AsyncMedia.MediaErrorEvent> l)Removes a listener so that it will no longer be notified of errors.
Parameters
lActionListener<AsyncMedia.MediaErrorEvent>- Listener
addMediaCompletionHandler
public void addMediaCompletionHandler(Runnable onComplete)Adds a callback to be run when the media has played to completion.
playAsync
public AsyncMedia.PlayRequest playAsync()Initiates a play request. Returns immediately without blocking. Caller can use
the returned PlayRequest object to be notified when playing has actually started.
pauseAsync
public AsyncMedia.PauseRequest pauseAsync()Initiates a pause request. Returns immediately without blocking. Caller can use
the returned PauseRequest object to be notified when media has actually paused.
playImpl
protected abstract void playImpl()Initiates a play request on the media.
pauseImpl
protected abstract void pauseImpl()Initiates a pause request on the media.
play
public final void play()Starts playing or recording the media file
pause
public final void pause()Pauses (actually stops) the playback or the recording of the media file