com.bramosystems.oss.player.uibinder.client
Class PlayerWrapper<T extends AbstractMediaPlayer>

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.Composite
              extended by com.bramosystems.oss.player.core.client.AbstractMediaPlayer
                  extended by com.bramosystems.oss.player.uibinder.client.PlayerWrapper<T>
Type Parameters:
T - the player implementation type
All Implemented Interfaces:
MatrixSupport, PlaylistSupport, HasMediaMessageHandlers, HasMediaProgressHandlers, HasMediaStateHandlers, HasPlayStateHandlers, com.google.gwt.event.dom.client.HasKeyDownHandlers, com.google.gwt.event.dom.client.HasKeyPressHandlers, com.google.gwt.event.dom.client.HasKeyUpHandlers, com.google.gwt.event.dom.client.HasMouseDownHandlers, com.google.gwt.event.dom.client.HasMouseMoveHandlers, com.google.gwt.event.dom.client.HasMouseUpHandlers, com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.IsWidget
Direct Known Subclasses:
Auto, Chromeless, DivXPlayer, FlashMediaPlayer, MatrixSupport, Native, PlaylistSupport, QuickTimePlayer, VLCPlayer, WinMediaPlayer, YouTube

Deprecated. Replaced with Player, will be removed in future.

public abstract class PlayerWrapper<T extends AbstractMediaPlayer>
extends AbstractMediaPlayer
implements MatrixSupport, PlaylistSupport

Provides the base implementation of player widgets with UiBinder support

Since:
1.1
Author:
Sikiru Braheem

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
protected  com.google.gwt.user.client.ui.Widget missingPluginNotice
          Deprecated.  
protected  com.google.gwt.user.client.ui.Widget missingPluginVersionNotice
          Deprecated.  
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
protected PlayerWrapper(java.lang.String mediaURL, boolean autoplay, java.lang.String height, java.lang.String width)
          Deprecated. The constructor
 
Method Summary
 void addToPlaylist(java.util.List<MRL> mediaLocators)
          Deprecated. Adds the media locators to the players' playlist.
 void addToPlaylist(MRL mediaLocator)
          Deprecated. Adds the media locator to the players' playlist.
 void addToPlaylist(java.lang.String... mediaURLs)
          Deprecated. Adds the media at the specified URLs to the players' playlist.
 void addToPlaylist(java.lang.String mediaURL)
          Deprecated. Adds the media at the specified URL to the players' playlist.
 void clearPlaylist()
          Deprecated. Removes all entries in the players' playlist
 T getEngine()
          Deprecated. Returns the underlying player implementation
 int getLoopCount()
          Deprecated. Returns the remaining number of times this player loops playback before stopping.
 TransformationMatrix getMatrix()
          Deprecated. Retrieves the current transformation matrix of the player.
 long getMediaDuration()
          Deprecated. Returns the duration of the loaded media in milliseconds.
 int getPlaylistSize()
          Deprecated. Returns the number of entries in the playlist
 double getPlayPosition()
          Deprecated. Gets the current position in the media that is being played.
 int getVideoHeight()
          Deprecated. Returns the height of the current media
 int getVideoWidth()
          Deprecated. Returns the width of the current media
 double getVolume()
          Deprecated. Gets the volume ranging from 0 (silent) to 1 (full volume).
protected abstract  T initPlayerEngine(java.lang.String mediaURL, boolean autoplay, java.lang.String height, java.lang.String width)
          Deprecated. Called by the constructor to create the player implementation wrapped by this widget
 boolean isControllerVisible()
          Deprecated. Checks whether the player controls are visible.
 boolean isResizeToVideoSize()
          Deprecated. Checks if player is set to adjust its size to match the dimensions of a video.
 boolean isShuffleEnabled()
          Deprecated. Checks if this player is in shuffle mode.
 void loadMedia(java.lang.String mediaURL)
          Deprecated. Loads the media at the specified URL into the player.
 void onLoad()
          Deprecated.  
 void pauseMedia()
          Deprecated. Pause the media playback
 void play(int index)
          Deprecated. Play playlist entry at the specified index
 void playMedia()
          Deprecated. Plays the media loaded into the player.
 void playNext()
          Deprecated. Plays the next item in the playlist
 void playPrevious()
          Deprecated. Plays the previous item in the playlist
 void removeFromPlaylist(int index)
          Deprecated. Removes the entry at the specified index from the players' playlist.
static java.lang.String resolveMediaURL(java.lang.String mediaURL)
          Deprecated. Parses the mediaURL for gwt-host:: and gwt-module:: keywords.
<T extends ConfigValue>
void
setConfigParameter(ConfigParameter param, T value)
          Deprecated. Sets the specified player parameter to the specified value IF AND ONLY IF the parameter is applicable on the player
 void setControllerVisible(boolean show)
          Deprecated. Displays or hides the player controls.
 void setLoopCount(int loop)
          Deprecated. Sets the number of times the current media file should loop playback before stopping.
 void setMatrix(TransformationMatrix matrix)
          Deprecated. Sets the transformation matrix on the player
 void setPlayPosition(double position)
          Deprecated. Sets the playback position of the current media
 void setResizeToVideoSize(boolean resize)
          Deprecated. If the current media is a video, sets the player to adjust its size to match the dimensions of the video
 void setShowLogger(boolean show)
          Deprecated. Convenience method for UiBinder support.
 void setShuffleEnabled(boolean enable)
          Deprecated. Enables or disables players' shuffle mode.
 void setVolume(double volume)
          Deprecated. Sets the volume.
 void showLogger(boolean show)
          Deprecated. Displays or hides the players' logger widget.
 void stopMedia()
          Deprecated. Stops the media playback.
 
Methods inherited from class com.bramosystems.oss.player.core.client.AbstractMediaPlayer
addDebugHandler, addKeyDownHandler, addKeyPressHandler, addKeyUpHandler, addLoadingProgressHandler, addMediaInfoHandler, addMouseDownHandler, addMouseMoveHandler, addMouseUpHandler, addPlayerStateHandler, addPlayStateHandler, addToPlayerReadyCommandQueue, fireDebug, fireError, fireLoadingProgress, fireMediaInfoAvailable, firePlayerStateEvent, firePlayStateEvent, getRate, getRepeatMode, getWidgetFactory, isPlayerOnPage, removeFromPlayerReadyCommandQueue, setConfigParameter, setConfigParameter, setRate, setRepeatMode
 
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, 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
 

Field Detail

missingPluginNotice

protected com.google.gwt.user.client.ui.Widget missingPluginNotice
Deprecated. 

missingPluginVersionNotice

protected com.google.gwt.user.client.ui.Widget missingPluginVersionNotice
Deprecated. 
Constructor Detail

PlayerWrapper

protected PlayerWrapper(java.lang.String mediaURL,
                        boolean autoplay,
                        java.lang.String height,
                        java.lang.String width)
Deprecated. 
The constructor

Parameters:
mediaURL - the URL of the media to playback
autoplay - true to autoplay, false otherwise
height - the height of the player (in CSS units)
width - the width of the player (in CSS units)
Method Detail

resolveMediaURL

public static java.lang.String resolveMediaURL(java.lang.String mediaURL)
Deprecated. 
Parses the mediaURL for gwt-host:: and gwt-module:: keywords. The keywords are effectively replaced with their corresponding relative URLs.

gwt-host:: is replaced with GWT.getHostPageBaseURL() while gwt-module:: is replaced with GWT.getModuleBaseURL()

Parameters:
mediaURL - the mediaURL
Returns:
the resulting absolute URL

onLoad

public void onLoad()
Deprecated. 
Overrides:
onLoad in class com.google.gwt.user.client.ui.Widget

getEngine

public T getEngine()
Deprecated. 
Returns the underlying player implementation

Returns:
the underlying player

initPlayerEngine

protected abstract T initPlayerEngine(java.lang.String mediaURL,
                                      boolean autoplay,
                                      java.lang.String height,
                                      java.lang.String width)
                                                           throws LoadException,
                                                                  PluginNotFoundException,
                                                                  PluginVersionException
Deprecated. 
Called by the constructor to create the player implementation wrapped by this widget

Parameters:
mediaURL - the resolved URL of the media to playback
autoplay - true to autoplay, false otherwise
height - the height of the player (in CSS units)
width - the width of the player (in CSS units)
Returns:
the player implementation
Throws:
LoadException - if an error occurs while loading the media.
PluginNotFoundException - if the required plugin is not installed on the client.
PluginVersionException - if the required plugin version is not installed on the client.

getMediaDuration

public long getMediaDuration()
Deprecated. 
Description copied from class: AbstractMediaPlayer
Returns the duration of the loaded media in milliseconds. An IllegalStateException is thrown is the player is not available

Specified by:
getMediaDuration in class AbstractMediaPlayer
Returns:
the duration of the loaded media in milliseconds.

getPlayPosition

public double getPlayPosition()
Deprecated. 
Description copied from class: AbstractMediaPlayer
Gets the current position in the media that is being played.

Specified by:
getPlayPosition in class AbstractMediaPlayer
Returns:
the current position of the media being played.

setPlayPosition

public void setPlayPosition(double position)
Deprecated. 
Description copied from class: AbstractMediaPlayer
Sets the playback position of the current media

Specified by:
setPlayPosition in class AbstractMediaPlayer
Parameters:
position - the new position from where to start playback

loadMedia

public void loadMedia(java.lang.String mediaURL)
               throws LoadException
Deprecated. 
Description copied from class: AbstractMediaPlayer
Loads the media at the specified URL into the player.

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.

Specified by:
loadMedia in class AbstractMediaPlayer
Parameters:
mediaURL - the URL of the media to load into the player.
Throws:
LoadException - if an error occurs while loading the media

pauseMedia

public void pauseMedia()
Deprecated. 
Description copied from class: AbstractMediaPlayer
Pause the media playback

Specified by:
pauseMedia in class AbstractMediaPlayer

playMedia

public void playMedia()
               throws PlayException
Deprecated. 
Description copied from class: AbstractMediaPlayer
Plays the media loaded into the player.

Specified by:
playMedia in class AbstractMediaPlayer
Throws:
PlayException - if an error occurs during media playback.

stopMedia

public void stopMedia()
Deprecated. 
Description copied from class: AbstractMediaPlayer
Stops the media playback.

Specified by:
stopMedia in class AbstractMediaPlayer

getVolume

public double getVolume()
Deprecated. 
Description copied from class: AbstractMediaPlayer
Gets the volume ranging from 0 (silent) to 1 (full volume).

Specified by:
getVolume in class AbstractMediaPlayer
Returns:
volume.

setVolume

public void setVolume(double volume)
Deprecated. 
Description copied from class: AbstractMediaPlayer
Sets the volume.

Specified by:
setVolume in class AbstractMediaPlayer
Parameters:
volume - 0 (silent) to 1 (full volume).

getLoopCount

public int getLoopCount()
Deprecated. 
Returns the remaining number of times this player loops playback before stopping.

Overrides:
getLoopCount in class AbstractMediaPlayer
Returns:
the number of times this player will repeat playback before stopping.

setLoopCount

public void setLoopCount(int loop)
Deprecated. 
Sets the number of times the current media file should loop playback before stopping.

Overrides:
setLoopCount in class AbstractMediaPlayer
Parameters:
loop - number of times to repeat playback. A negative value makes playback repeat forever!.

showLogger

public void showLogger(boolean show)
Deprecated. 
Description copied from class: AbstractMediaPlayer
Displays or hides the players' logger widget. The logger widget logs debug messages which can be useful during development.

Overrides:
showLogger in class AbstractMediaPlayer
Parameters:
show - true to make the logger widget visible, false otherwise.
See Also:
Logger

setShowLogger

public void setShowLogger(boolean show)
Deprecated. 
Convenience method for UiBinder support. Displays or hides the players' logger widget.

Parameters:
show - true to make the logger widget visible, false otherwise.
See Also:
showLogger(boolean)

getVideoHeight

public int getVideoHeight()
Deprecated. 
Description copied from class: AbstractMediaPlayer
Returns the height of the current media

Overrides:
getVideoHeight in class AbstractMediaPlayer
Returns:
the height in pixels

getVideoWidth

public int getVideoWidth()
Deprecated. 
Description copied from class: AbstractMediaPlayer
Returns the width of the current media

Overrides:
getVideoWidth in class AbstractMediaPlayer
Returns:
the width in pixels

isControllerVisible

public boolean isControllerVisible()
Deprecated. 
Description copied from class: AbstractMediaPlayer
Checks whether the player controls are visible. This implementation return true. Subclasses that permit showing/hiding of controls should override this method and implement accordingly.

Overrides:
isControllerVisible in class AbstractMediaPlayer
Returns:
true if player controls are visible, false otherwise.

isResizeToVideoSize

public boolean isResizeToVideoSize()
Deprecated. 
Description copied from class: AbstractMediaPlayer
Checks if player is set to adjust its size to match the dimensions of a video.

Overrides:
isResizeToVideoSize in class AbstractMediaPlayer
Returns:
true if player adjusts its size, false otherwise

setConfigParameter

public <T extends ConfigValue> void setConfigParameter(ConfigParameter param,
                                                       T value)
Deprecated. 
Description copied from class: AbstractMediaPlayer
Sets the specified player parameter to the specified value IF AND ONLY IF the parameter is applicable on the player

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.

Overriding in a subclass

This method should be called first by any subclass that overrides it. This implementation checks if the specified value is a valid type for the specified parameter.

Overrides:
setConfigParameter in class AbstractMediaPlayer
Type Parameters:
T - the paramter value type
Parameters:
param - the configuration parameter
value - the parameter value

setControllerVisible

public void setControllerVisible(boolean show)
Deprecated. 
Description copied from class: AbstractMediaPlayer
Displays or hides the player controls. This implementation does nothing. Subclasses that permit showing/hiding of controls should override this method and implement accordingly.

Overrides:
setControllerVisible in class AbstractMediaPlayer
Parameters:
show - true to make the player controls visible, false otherwise.

setResizeToVideoSize

public void setResizeToVideoSize(boolean resize)
Deprecated. 
Description copied from class: AbstractMediaPlayer
If the current media is a video, sets the player to adjust its size to match the dimensions of the video

Overrides:
setResizeToVideoSize in class AbstractMediaPlayer
Parameters:
resize - true if player should adjust its size, false otherwise

addToPlaylist

public void addToPlaylist(java.lang.String mediaURL)
Deprecated. 
Description copied from interface: PlaylistSupport
Adds the media at the specified URL to the players' playlist.

In respect of the same domain policy of some plugins/browsers, the URL should point to a destination on the same domain where the application is hosted.

Specified by:
addToPlaylist in interface PlaylistSupport
Parameters:
mediaURL - the URL of the media.

addToPlaylist

public void addToPlaylist(MRL mediaLocator)
Deprecated. 
Description copied from interface: PlaylistSupport
Adds the media locator to the players' playlist.

Specified by:
addToPlaylist in interface PlaylistSupport
Parameters:
mediaLocator - specifies alternative URLs of the same media

addToPlaylist

public void addToPlaylist(java.lang.String... mediaURLs)
Deprecated. 
Description copied from interface: PlaylistSupport
Adds the media at the specified URLs to the players' playlist.

The player chooses ONLY ONE of the mediaURLs it supports.

In respect of the same domain policy of some browsers, the URLs should point to a destination on the same domain where the application is hosted.

Specified by:
addToPlaylist in interface PlaylistSupport
Parameters:
mediaURLs - the alternative URLs of the same media (probably in different formats).

addToPlaylist

public void addToPlaylist(java.util.List<MRL> mediaLocators)
Deprecated. 
Description copied from interface: PlaylistSupport
Adds the media locators to the players' playlist.

Specified by:
addToPlaylist in interface PlaylistSupport
Parameters:
mediaLocators - list of alternative URLs of the same media

isShuffleEnabled

public boolean isShuffleEnabled()
Deprecated. 
Description copied from interface: PlaylistSupport
Checks if this player is in shuffle mode.

Specified by:
isShuffleEnabled in interface PlaylistSupport
Returns:
true if player is in shuffle mode, false otherwise.

removeFromPlaylist

public void removeFromPlaylist(int index)
Deprecated. 
Description copied from interface: PlaylistSupport
Removes the entry at the specified index from the players' playlist.

Specified by:
removeFromPlaylist in interface PlaylistSupport
Parameters:
index - the index of the playlist entry.

setShuffleEnabled

public void setShuffleEnabled(boolean enable)
Deprecated. 
Description copied from interface: PlaylistSupport
Enables or disables players' shuffle mode.

Specified by:
setShuffleEnabled in interface PlaylistSupport
Parameters:
enable - true to enable shuffle, false otherwise

clearPlaylist

public void clearPlaylist()
Deprecated. 
Description copied from interface: PlaylistSupport
Removes all entries in the players' playlist

Specified by:
clearPlaylist in interface PlaylistSupport

getPlaylistSize

public int getPlaylistSize()
Deprecated. 
Description copied from interface: PlaylistSupport
Returns the number of entries in the playlist

Specified by:
getPlaylistSize in interface PlaylistSupport
Returns:
number of entries in the playlist

play

public void play(int index)
          throws java.lang.IndexOutOfBoundsException
Deprecated. 
Description copied from interface: PlaylistSupport
Play playlist entry at the specified index

Specified by:
play in interface PlaylistSupport
Parameters:
index - number of the playlist entry
Throws:
java.lang.IndexOutOfBoundsException - if index is outside the bounds of the playlist

playNext

public void playNext()
              throws PlayException
Deprecated. 
Description copied from interface: PlaylistSupport
Plays the next item in the playlist

Specified by:
playNext in interface PlaylistSupport
Throws:
PlayException - if there are no more entries in the playlist to be played. Especially if we've advanced to the end of the playlist. Note: A player with a negative loop count (i.e. set to play forever!) may not throw this exception

playPrevious

public void playPrevious()
                  throws PlayException
Deprecated. 
Description copied from interface: PlaylistSupport
Plays the previous item in the playlist

Specified by:
playPrevious in interface PlaylistSupport
Throws:
PlayException - if there are no more entries in the playlist to be played. Especially if we've gotten to the beginning of the playlist. Note: A player with a negative loop count (i.e. set to play forever!) may not throw this exception

setMatrix

public void setMatrix(TransformationMatrix matrix)
Deprecated. 
Description copied from interface: MatrixSupport
Sets the transformation matrix on the player

Specified by:
setMatrix in interface MatrixSupport
Parameters:
matrix - the transformation matrix

getMatrix

public TransformationMatrix getMatrix()
Deprecated. 
Description copied from interface: MatrixSupport
Retrieves the current transformation matrix of the player.

Note: Changing the properties of the returned object has no effect on the transformation matrix of the underlying plugin. You will have to call MatrixSupport.setMatrix(TransformationMatrix) to effect any change.

Specified by:
getMatrix in interface MatrixSupport
Returns:
the current transformation matrix


Copyright © 2009-2011. All Rights Reserved.