|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.gwt.user.client.ui.UIObject com.google.gwt.user.client.ui.Widget com.google.gwt.user.client.ui.Composite com.bramosystems.oss.player.core.client.AbstractMediaPlayer
public abstract class AbstractMediaPlayer
Abstract implementation of a media player. It implements the handling of MediaStateListeners.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject |
---|
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled |
Field Summary |
---|
Fields inherited from class com.google.gwt.user.client.ui.UIObject |
---|
DEBUG_ID_PREFIX |
Constructor Summary | |
---|---|
AbstractMediaPlayer()
Constructor method. |
Method Summary | ||
---|---|---|
com.google.gwt.event.shared.HandlerRegistration |
addDebugHandler(DebugHandler handler)
Adds the specified debug handler to the player |
|
com.google.gwt.event.shared.HandlerRegistration |
addKeyDownHandler(com.google.gwt.event.dom.client.KeyDownHandler handler)
Adds the key down handler to the player |
|
com.google.gwt.event.shared.HandlerRegistration |
addKeyPressHandler(com.google.gwt.event.dom.client.KeyPressHandler handler)
Adds the key press handler to the player |
|
com.google.gwt.event.shared.HandlerRegistration |
addKeyUpHandler(com.google.gwt.event.dom.client.KeyUpHandler handler)
Adds the key up handler to the player |
|
com.google.gwt.event.shared.HandlerRegistration |
addLoadingProgressHandler(LoadingProgressHandler handler)
Adds the specified loading progress handler to the player |
|
com.google.gwt.event.shared.HandlerRegistration |
addMediaInfoHandler(MediaInfoHandler handler)
Adds the specified MediaInfo handler to the player |
|
com.google.gwt.event.shared.HandlerRegistration |
addMouseDownHandler(com.google.gwt.event.dom.client.MouseDownHandler handler)
Adds the mouse down handler to the player |
|
com.google.gwt.event.shared.HandlerRegistration |
addMouseMoveHandler(com.google.gwt.event.dom.client.MouseMoveHandler handler)
Adds the mouse move handler to the player |
|
com.google.gwt.event.shared.HandlerRegistration |
addMouseUpHandler(com.google.gwt.event.dom.client.MouseUpHandler handler)
Adds the mouse up handler to the player |
|
com.google.gwt.event.shared.HandlerRegistration |
addPlayerStateHandler(PlayerStateHandler handler)
Adds the specified player-state handler to the player |
|
com.google.gwt.event.shared.HandlerRegistration |
addPlayStateHandler(PlayStateHandler handler)
Adds the specified play-state handler to the player |
|
protected void |
addToPlayerReadyCommandQueue(java.lang.String key,
com.google.gwt.user.client.Command command)
Adds the specified command to this players' command queue. |
|
protected void |
fireDebug(java.lang.String message)
Convenience method to fire DebugEvent 's with informational messages
on registered handlers. |
|
protected void |
fireError(java.lang.String description)
Convenience method to fire error type DebugEvent 's on registered handlers. |
|
protected void |
fireLoadingProgress(double progress)
Convenience method to fire LoadingProgressEvent 's on registered handlers. |
|
protected void |
fireMediaInfoAvailable(MediaInfo info)
Convenience method to fire MediaInfoEvent 's on registered handlers. |
|
protected void |
firePlayerStateEvent(PlayerStateEvent.State state)
Convenience method to fire PlayerStateEvent 's on registered handlers. |
|
protected void |
firePlayStateEvent(PlayStateEvent.State state,
int itemIndex)
Convenience method to fire PlayStateEvent 's on registered handlers. |
|
int |
getLoopCount()
Returns the number of times this player repeats playback before stopping. |
|
abstract long |
getMediaDuration()
Returns the duration of the loaded media in milliseconds. |
|
abstract double |
getPlayPosition()
Gets the current position in the media that is being played. |
|
double |
getRate()
Returns the current playback rate |
|
RepeatMode |
getRepeatMode()
Returns the current playback repeat mode |
|
int |
getVideoHeight()
Returns the height of the current media |
|
int |
getVideoWidth()
Returns the width of the current media |
|
abstract double |
getVolume()
Gets the volume ranging from 0 (silent) to 1 (full volume). |
|
protected PlayerProviderFactory |
getWidgetFactory(java.lang.String providerName)
Returns a reference to the PlayerProviderFactory implementation with the specified providerName |
|
boolean |
isControllerVisible()
Checks whether the player controls are visible. |
|
protected static boolean |
isPlayerOnPage(java.lang.String playerId)
Checks if the player plugin with the specified playerId is attached to the browsers' DOM |
|
boolean |
isResizeToVideoSize()
Checks if player is set to adjust its size to match the dimensions of a video. |
|
abstract void |
loadMedia(java.lang.String mediaURL)
Loads the media at the specified URL into the player. |
|
abstract void |
pauseMedia()
Pause the media playback |
|
abstract void |
playMedia()
Plays the media loaded into the player. |
|
protected void |
removeFromPlayerReadyCommandQueue(java.lang.String key)
Removes a queued command with the specified key from this players'
command queue. |
|
void |
setConfigParameter(ConfigParameter param,
java.lang.Number value)
Sets the specified player parameter to the specified value IF AND ONLY IF the parameter is applicable on the player |
|
void |
setConfigParameter(ConfigParameter param,
java.lang.String value)
Sets the specified player parameter to the specified value IF AND ONLY IF the parameter is applicable on the player |
|
|
setConfigParameter(ConfigParameter param,
T value)
Sets the specified player parameter to the specified value IF AND ONLY IF the parameter is applicable on the player |
|
void |
setControllerVisible(boolean show)
Displays or hides the player controls. |
|
void |
setLoopCount(int loop)
Sets the number of times the current media file should repeat playback before stopping. |
|
abstract void |
setPlayPosition(double position)
Sets the playback position of the current media |
|
void |
setRate(double rate)
Sets the playback rate. |
|
void |
setRepeatMode(RepeatMode mode)
Puts the player in the specified repeat mode. |
|
void |
setResizeToVideoSize(boolean resize)
If the current media is a video, sets the player to adjust its size to match the dimensions of the video |
|
abstract void |
setVolume(double volume)
Sets the volume. |
|
void |
showLogger(boolean show)
Displays or hides the players' logger widget. |
|
abstract void |
stopMedia()
Stops the media playback. |
Methods inherited from class com.google.gwt.user.client.ui.Composite |
---|
getWidget, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, setWidget |
Methods inherited from class com.google.gwt.user.client.ui.Widget |
---|
addAttachHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents |
Methods inherited from class com.google.gwt.user.client.ui.UIObject |
---|
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, toString, unsinkEvents |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
---|
fireEvent |
Constructor Detail |
---|
public AbstractMediaPlayer()
Method Detail |
---|
public abstract void loadMedia(java.lang.String mediaURL) throws LoadException
In respect of the same domain
policy of some plugins,
the URL should point to a destination on the same domain
where the application is hosted.
mediaURL
- the URL of the media to load into the player.
LoadException
- if an error occurs while loading the media
java.lang.IllegalStateException
- if the player is not available, this is the case
if the player is not attached to the DOM.public abstract void playMedia() throws PlayException
PlayException
- if an error occurs
during media playback.
java.lang.IllegalStateException
- if the player is not available, this is the case
if the player is not attached to the DOM.public abstract void stopMedia()
java.lang.IllegalStateException
- if the player is not available, this is the case
if the player is not attached to the DOM.public abstract void pauseMedia()
java.lang.IllegalStateException
- if the player is not available, this is the case
if the player is not attached to the DOM.public abstract long getMediaDuration()
java.lang.IllegalStateException
- if the player is not available, this is the case
if the player is not attached to the DOM.public abstract double getPlayPosition()
java.lang.IllegalStateException
- if the player is not available, this is the case
if the player is not attached to the DOM.public abstract void setPlayPosition(double position)
position
- the new position from where to start playback
java.lang.IllegalStateException
- if the player is not available, this is the case
if the player is not attached to the DOM.public abstract double getVolume()
0
(silent) to 1
(full volume).
java.lang.IllegalStateException
- if the player is not available, this is the case
if the player is not attached to the DOM.public abstract void setVolume(double volume)
volume
- 0
(silent) to 1
(full volume).
java.lang.IllegalStateException
- if the player is not available, this is the case
if the player is not attached to the DOM.protected final void firePlayStateEvent(PlayStateEvent.State state, int itemIndex)
PlayStateEvent
's on registered handlers.
state
- the state of the playerPlayStateEvent
protected final void firePlayerStateEvent(PlayerStateEvent.State state)
PlayerStateEvent
's on registered handlers.
state
- the state of the playerPlayerStateEvent
protected final void fireError(java.lang.String description)
DebugEvent
's on registered handlers.
description
- the description of the errorDebugEvent
protected final void fireDebug(java.lang.String message)
DebugEvent
's with informational messages
on registered handlers.
message
- the messageDebugEvent
protected final void fireLoadingProgress(double progress)
LoadingProgressEvent
's on registered handlers.
progress
- the progress of the loading operationLoadingProgressEvent
protected final void fireMediaInfoAvailable(MediaInfo info)
MediaInfoEvent
's on registered handlers.
info
- the metadata of the loaded mediaMediaInfoEvent
public void showLogger(boolean show)
show
- true
to make the logger widget visible, false
otherwise.Logger
public void setControllerVisible(boolean show)
show
- true
to make the player controls visible, false
otherwise.public boolean isControllerVisible()
true
if player controls are visible, false
otherwise.public void setLoopCount(int loop)
NB: As of version 1.2, the behaviour of this property depends on
the setRepeatMode(RepeatMode)
property
loop
- number of times to repeat playback. A negative value makes playback repeat forever!.public int getLoopCount()
0
, subclasses should override and implement
accordingly.
protected final void addToPlayerReadyCommandQueue(java.lang.String key, com.google.gwt.user.client.Command command)
The execution of the commands is tied to the Ready
state of the
PlayerState
event of the underlying plugin.
All scheduled commands are executed exactly once.
Note: If multiple commands use the same key, only the last command is executed.
key
- key with which the specified command is to be associatedcommand
- the command to execute when the player plugin is ready for interactionprotected final void removeFromPlayerReadyCommandQueue(java.lang.String key)
key
from this players'
command queue.
key
- key whose command is to be removedaddToPlayerReadyCommandQueue(java.lang.String, com.google.gwt.user.client.Command)
public final com.google.gwt.event.shared.HandlerRegistration addLoadingProgressHandler(LoadingProgressHandler handler)
addLoadingProgressHandler
in interface HasMediaProgressHandlers
handler
- the handler
LoadingProgressHandler
public final com.google.gwt.event.shared.HandlerRegistration addMediaInfoHandler(MediaInfoHandler handler)
addMediaInfoHandler
in interface HasMediaMessageHandlers
handler
- the handler
MediaInfoHandler
public final com.google.gwt.event.shared.HandlerRegistration addPlayStateHandler(PlayStateHandler handler)
addPlayStateHandler
in interface HasPlayStateHandlers
handler
- the handler
PlayStateHandler
public final com.google.gwt.event.shared.HandlerRegistration addPlayerStateHandler(PlayerStateHandler handler)
addPlayerStateHandler
in interface HasPlayStateHandlers
handler
- the handler
PlayerStateHandler
public final com.google.gwt.event.shared.HandlerRegistration addDebugHandler(DebugHandler handler)
addDebugHandler
in interface HasMediaMessageHandlers
handler
- the handler
DebugHandler
public void setResizeToVideoSize(boolean resize)
resize
- true
if player should adjust its size,
false
otherwisepublic boolean isResizeToVideoSize()
true
if player adjusts its size, false
otherwisepublic int getVideoHeight()
public int getVideoWidth()
protected static final boolean isPlayerOnPage(java.lang.String playerId)
This method is provided for the convenience of player implementation classes.
playerId
- the object ID of the player plugin
true
if player plugin is attached, false
otherwise.public <T extends ConfigValue> void setConfigParameter(ConfigParameter param, T value)
Note: The parameter-value pairs are applied as HTML param tags on the underlying player plugin, therefore this method should be called before adding this player to a panel otherwise the method call will have no effect.
T
- the paramter value typeparam
- the configuration parametervalue
- the parameter value
java.lang.IllegalArgumentException
- if value
is not of the required typepublic void setConfigParameter(ConfigParameter param, java.lang.Number value)
param
- the configuration parametervalue
- the numeric value
java.lang.IllegalArgumentException
- if param
is not useable with a numbersetConfigParameter(ConfigParameter, ConfigValue)
public void setConfigParameter(ConfigParameter param, java.lang.String value)
param
- the configuration parametervalue
- the String value
java.lang.IllegalArgumentException
- if param
is not useable with a StringsetConfigParameter(ConfigParameter, ConfigValue)
public void setRate(double rate)
If this player is not available on the panel, this method call is added to the command-queue for later execution.
rate
- the playback rate. A rate of 1 implies normal playback rate,
fractional values are slow motion, and values greater than one are fast-forwardpublic double getRate()
setRate(double)
public com.google.gwt.event.shared.HandlerRegistration addMouseMoveHandler(com.google.gwt.event.dom.client.MouseMoveHandler handler)
addMouseMoveHandler
in interface com.google.gwt.event.dom.client.HasMouseMoveHandlers
handler
- the handler
public com.google.gwt.event.shared.HandlerRegistration addMouseDownHandler(com.google.gwt.event.dom.client.MouseDownHandler handler)
addMouseDownHandler
in interface com.google.gwt.event.dom.client.HasMouseDownHandlers
handler
- the handler
public com.google.gwt.event.shared.HandlerRegistration addMouseUpHandler(com.google.gwt.event.dom.client.MouseUpHandler handler)
addMouseUpHandler
in interface com.google.gwt.event.dom.client.HasMouseUpHandlers
handler
- the handler
public com.google.gwt.event.shared.HandlerRegistration addKeyDownHandler(com.google.gwt.event.dom.client.KeyDownHandler handler)
addKeyDownHandler
in interface com.google.gwt.event.dom.client.HasKeyDownHandlers
handler
- the handler
public com.google.gwt.event.shared.HandlerRegistration addKeyUpHandler(com.google.gwt.event.dom.client.KeyUpHandler handler)
addKeyUpHandler
in interface com.google.gwt.event.dom.client.HasKeyUpHandlers
handler
- the handler
public com.google.gwt.event.shared.HandlerRegistration addKeyPressHandler(com.google.gwt.event.dom.client.KeyPressHandler handler)
addKeyPressHandler
in interface com.google.gwt.event.dom.client.HasKeyPressHandlers
handler
- the handler
public void setRepeatMode(RepeatMode mode)
The effect of the specified mode depends on the setLoopCount(int)
property as
shown in the table:
Value of loopCount |
Value of repeatMode |
What it means? |
---|---|---|
Any value < 0 | Sets repeatMode to RepeatMode.REPEAT_ALL |
Playlist is repeated continously |
1 | RepeatMode.REPEAT_OFF |
Entire playlist is played only once |
RepeatMode.REPEAT_ONE |
The current playlist entry is repeated continously | |
RepeatMode.REPEAT_ALL |
Entire playlist is repeated continously | |
Any value > 1 | RepeatMode.REPEAT_OFF |
The loopCount property is ignored, and the entire playlist is played only once |
RepeatMode.REPEAT_ONE |
Player repeats each playlist entry for the number of times specified by loopCount
and moves on the next until all entries are played and stops |
|
RepeatMode.REPEAT_ALL |
Player repeats entire playlist for the number of times specified by loopCount and stops |
mode
- the new repeat modeRepeatMode
public RepeatMode getRepeatMode()
RepeatMode
protected final PlayerProviderFactory getWidgetFactory(java.lang.String providerName)
providerName
This method is provided for the convenience of player implementation classes.
providerName
- the provider name
providerName
or null
if no such provider exists.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |