public class Player extends AbstractMediaPlayer implements MatrixSupport, PlaylistSupport
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui'
xmlns:player='urn:import:com.bramosystems.oss.player.uibinder.client'>
...
<player:Player name='Auto' autoplay='true' height='20px' width='100%'
mediaURL='GWT-HOST::media/cool-media.mp3' >
<p:missingPluginNotice>
<g:Label styleName='{some-style}'>Required player plugin not available !</g:Label>
</p:missingPluginNotice>
</player >
...
</ui:UiBinder>
| Modifier and Type | Field and Description |
|---|---|
protected com.google.gwt.user.client.ui.Widget |
loadWidget |
protected com.google.gwt.user.client.ui.Widget |
missingPluginNotice |
protected com.google.gwt.user.client.ui.Widget |
missingPluginVersionNotice |
| Constructor and Description |
|---|
Player(String name,
boolean autoplay,
String mediaURL,
String height,
String width)
The constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
addToPlaylist(List<MRL> mediaLocators)
Adds the media locators to the players' playlist.
|
void |
addToPlaylist(MRL mediaLocator)
Adds the media locator to the players' playlist.
|
void |
addToPlaylist(String... mediaURLs)
Adds the media at the specified URLs to the players' playlist.
|
void |
addToPlaylist(String mediaURL)
Adds the media at the specified URL to the players' playlist.
|
void |
clearPlaylist()
Removes all entries in the players' playlist
|
AbstractMediaPlayer |
getEngine()
Returns the underlying player implementation
|
int |
getLoopCount()
Returns the remaining number of times this player loops playback before stopping.
|
TransformationMatrix |
getMatrix()
Retrieves the current transformation matrix of the player.
|
long |
getMediaDuration()
Returns the duration of the loaded media in milliseconds.
|
int |
getPlaylistSize()
Returns the number of entries in the playlist
|
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
|
double |
getVolume()
Gets the volume ranging from
0 (silent) to 1 (full volume). |
boolean |
isControllerVisible()
Checks whether the player controls are visible.
|
boolean |
isResizeToVideoSize()
Checks if player is set to adjust its size to match the dimensions of a video.
|
boolean |
isShuffleEnabled()
Checks if this player is in shuffle mode.
|
void |
loadMedia(String mediaURL)
Loads the media at the specified URL into the player.
|
void |
onLoad() |
void |
pauseMedia()
Pause the media playback
|
void |
play(int index)
Play playlist entry at the specified
index |
void |
playMedia()
Plays the media loaded into the player.
|
void |
playNext()
Plays the next item in the playlist
|
void |
playPrevious()
Plays the previous item in the playlist
|
void |
removeFromPlaylist(int index)
Removes the entry at the specified index from the players' playlist.
|
static String |
resolveMediaURL(String mediaURL)
Parses the
mediaURL for gwt-host:: and gwt-module:: keywords. |
<C extends ConfigParameter> |
setConfigParameter(C param,
Object 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 loop playback before stopping.
|
void |
setMatrix(TransformationMatrix matrix)
Sets the transformation matrix on the player
|
void |
setMissingPluginNotice(com.google.gwt.user.client.ui.Widget w) |
void |
setMissingPluginVersionNotice(com.google.gwt.user.client.ui.Widget w) |
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
|
void |
setShuffleEnabled(boolean enable)
Enables or disables players' shuffle mode.
|
void |
setVolume(double volume)
Sets the volume.
|
void |
stopMedia()
Stops the media playback.
|
addDebugHandler, addKeyDownHandler, addKeyPressHandler, addKeyUpHandler, addLoadingProgressHandler, addMediaInfoHandler, addMouseDownHandler, addMouseMoveHandler, addMouseUpHandler, addPlayerStateHandler, addPlayStateHandler, addToPlayerReadyCommandQueue, fireDebug, fireError, fireLoadingProgress, fireMediaInfoAvailable, firePlayerStateEvent, firePlayStateEvent, getWidgetFactory, isPlayerOnPage, removeFromPlayerReadyCommandQueueclaimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidgetaddAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onUnload, removeFromParent, setLayoutData, sinkEventsaddStyleDependentName, 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, sinkBitlessEvent, toString, unsinkEventsprotected com.google.gwt.user.client.ui.Widget missingPluginNotice
protected com.google.gwt.user.client.ui.Widget missingPluginVersionNotice
protected com.google.gwt.user.client.ui.Widget loadWidget
@UiConstructor public Player(String name, boolean autoplay, String mediaURL, String height, String width)
mediaURL - the URL of the media to playbackautoplay - true to autoplay, false otherwiseheight - the height of the player (in CSS units)width - the width of the player (in CSS units)public static String resolveMediaURL(String mediaURL)
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()
mediaURL - the mediaURLpublic void onLoad()
onLoad in class com.google.gwt.user.client.ui.Widget@UiChild(limit=1,
tagname="missingPluginNotice")
public void setMissingPluginNotice(com.google.gwt.user.client.ui.Widget w)
@UiChild(limit=1,
tagname="missingPluginVersionNotice")
public void setMissingPluginVersionNotice(com.google.gwt.user.client.ui.Widget w)
public AbstractMediaPlayer getEngine()
public long getMediaDuration()
AbstractMediaPlayergetMediaDuration in class AbstractMediaPlayerpublic double getPlayPosition()
AbstractMediaPlayergetPlayPosition in class AbstractMediaPlayerpublic void setPlayPosition(double position)
AbstractMediaPlayersetPlayPosition in class AbstractMediaPlayerposition - the new position from where to start playbackpublic void loadMedia(String mediaURL) throws LoadException
AbstractMediaPlayerIn 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.
loadMedia in class AbstractMediaPlayermediaURL - the URL of the media to load into the player.LoadException - if an error occurs while loading the mediapublic void pauseMedia()
AbstractMediaPlayerpauseMedia in class AbstractMediaPlayerpublic void playMedia()
throws PlayException
AbstractMediaPlayerplayMedia in class AbstractMediaPlayerPlayException - if an error occurs
during media playback.public void stopMedia()
AbstractMediaPlayerstopMedia in class AbstractMediaPlayerpublic double getVolume()
AbstractMediaPlayer0 (silent) to 1 (full volume).getVolume in class AbstractMediaPlayerpublic void setVolume(double volume)
AbstractMediaPlayersetVolume in class AbstractMediaPlayervolume - 0 (silent) to 1 (full volume).public int getLoopCount()
getLoopCount in class AbstractMediaPlayerpublic void setLoopCount(int loop)
setLoopCount in class AbstractMediaPlayerloop - number of times to repeat playback. A negative value makes playback repeat forever!.public int getVideoHeight()
AbstractMediaPlayergetVideoHeight in class AbstractMediaPlayerpublic int getVideoWidth()
AbstractMediaPlayergetVideoWidth in class AbstractMediaPlayerpublic boolean isControllerVisible()
AbstractMediaPlayerisControllerVisible in class AbstractMediaPlayertrue if player controls are visible, false otherwise.public boolean isResizeToVideoSize()
AbstractMediaPlayerisResizeToVideoSize in class AbstractMediaPlayertrue if player adjusts its size, false otherwisepublic <C extends ConfigParameter> void setConfigParameter(C param, Object value)
AbstractMediaPlayerNote: 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.
setConfigParameter in class AbstractMediaPlayerC - the paramter value typeparam - the configuration parametervalue - the parameter valuepublic void setControllerVisible(boolean show)
AbstractMediaPlayersetControllerVisible in class AbstractMediaPlayershow - true to make the player controls visible, false otherwise.public void setResizeToVideoSize(boolean resize)
AbstractMediaPlayersetResizeToVideoSize in class AbstractMediaPlayerresize - true if player should adjust its size,
false otherwisepublic void addToPlaylist(String mediaURL)
PlaylistSupportIn 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.
addToPlaylist in interface PlaylistSupportmediaURL - the URL of the media.public void addToPlaylist(MRL mediaLocator)
PlaylistSupportaddToPlaylist in interface PlaylistSupportmediaLocator - specifies alternative URLs of the same mediapublic void addToPlaylist(String... mediaURLs)
PlaylistSupportThe 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.
addToPlaylist in interface PlaylistSupportmediaURLs - the alternative URLs of the same media (probably in different formats).public void addToPlaylist(List<MRL> mediaLocators)
PlaylistSupportaddToPlaylist in interface PlaylistSupportmediaLocators - list of alternative URLs of the same mediapublic boolean isShuffleEnabled()
PlaylistSupportisShuffleEnabled in interface PlaylistSupporttrue if player is in shuffle mode, false otherwise.public void removeFromPlaylist(int index)
PlaylistSupportremoveFromPlaylist in interface PlaylistSupportindex - the index of the playlist entry.public void setShuffleEnabled(boolean enable)
PlaylistSupportsetShuffleEnabled in interface PlaylistSupportenable - true to enable shuffle, false otherwisepublic void clearPlaylist()
PlaylistSupportclearPlaylist in interface PlaylistSupportpublic int getPlaylistSize()
PlaylistSupportgetPlaylistSize in interface PlaylistSupportpublic void play(int index)
throws IndexOutOfBoundsException
PlaylistSupportindexplay in interface PlaylistSupportindex - number of the playlist entryIndexOutOfBoundsException - if index is outside the bounds of the playlistpublic void playNext()
throws PlayException
PlaylistSupportplayNext in interface PlaylistSupportPlayException - 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 exceptionpublic void playPrevious()
throws PlayException
PlaylistSupportplayPrevious in interface PlaylistSupportPlayException - 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 exceptionpublic void setMatrix(TransformationMatrix matrix)
MatrixSupportsetMatrix in interface MatrixSupportmatrix - the transformation matrixpublic TransformationMatrix getMatrix()
MatrixSupportNote: 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.
getMatrix in interface MatrixSupportpublic double getRate()
AbstractMediaPlayergetRate in class AbstractMediaPlayerAbstractMediaPlayer.setRate(double)public RepeatMode getRepeatMode()
AbstractMediaPlayergetRepeatMode in class AbstractMediaPlayerRepeatModepublic void setRate(double rate)
AbstractMediaPlayerIf this player is not available on the panel, this method call is added to the command-queue for later execution.
setRate in class AbstractMediaPlayerrate - the playback rate. A rate of 1 implies normal playback rate,
fractional values are slow motion, and values greater than one are fast-forwardpublic void setRepeatMode(RepeatMode mode)
AbstractMediaPlayerThe effect of the specified mode depends on the AbstractMediaPlayer.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 |
setRepeatMode in class AbstractMediaPlayermode - the new repeat modeRepeatModeCopyright © 2009-2013. All Rights Reserved.