public class FlashMediaPlayer
extends com.bramosystems.oss.player.core.client.AbstractMediaPlayer
implements com.bramosystems.oss.player.core.client.PlaylistSupport, com.bramosystems.oss.player.core.client.geom.MatrixSupport
SimplePanel panel = new SimplePanel(); // create panel to hold the player
Widget player = null;
try {
// create the player
player = new FlashMediaPlayer("www.example.com/mediafile.flv", false, "200px", "250px");
} catch(PluginVersionException e) {
// catch plugin version exception and alert user to download plugin first.
// An option is to use the utility method in PlayerUtil class.
player = PlayerUtil.getMissingPluginNotice(Plugin.FlashMediaPlayer, "Missing Plugin",
".. some nice message telling the user to click and download plugin first ..",
false);
} catch(PluginNotFoundException e) {
// catch PluginNotFoundException and tell user to download plugin, possibly providing
// a link to the plugin download page.
player = new HTML(".. another kind of message telling the user to download plugin..");
}
panel.setWidget(player); // add player to panel.
This player supports M3U formatted playlists. However, each entry in the playlist MUST be a flash-supported media file.
Constructor and Description |
---|
FlashMediaPlayer(String mediaURL)
Constructs
FlashMediaPlayer to automatically playback media located at
mediaURL . |
FlashMediaPlayer(String mediaURL,
boolean autoplay)
Constructs
FlashMediaPlayer to playback media located at mediaURL . |
FlashMediaPlayer(String mediaURL,
boolean autoplay,
String height,
String width)
Constructs
FlashMediaPlayer with the specified height and
width to playback media located at mediaURL . |
Modifier and Type | Method and Description |
---|---|
void |
addToPlaylist(List<com.bramosystems.oss.player.core.client.playlist.MRL> mediaLocators) |
void |
addToPlaylist(com.bramosystems.oss.player.core.client.playlist.MRL mediaLocator) |
void |
addToPlaylist(String... mediaURLs) |
void |
addToPlaylist(String mediaURL) |
void |
clearPlaylist() |
int |
getLoopCount()
Returns the number of times this player repeats playback before stopping.
|
com.bramosystems.oss.player.core.client.geom.TransformationMatrix |
getMatrix() |
long |
getMediaDuration() |
int |
getPlaylistSize() |
double |
getPlayPosition() |
com.bramosystems.oss.player.core.client.RepeatMode |
getRepeatMode() |
int |
getVideoHeight() |
int |
getVideoWidth() |
double |
getVolume() |
boolean |
isAutoHideController()
Checks whether the player automatically hides its controls.
|
boolean |
isControllerVisible()
Checks whether the player controls are visible.
|
boolean |
isResizeToVideoSize() |
boolean |
isShuffleEnabled() |
void |
loadMedia(String mediaURL) |
protected void |
onLoad()
Overriden to register associated resources
|
protected void |
onUnload()
Overriden to release associated resources
|
void |
pauseMedia() |
void |
play(int index) |
void |
playMedia() |
void |
playNext() |
void |
playPrevious() |
void |
removeFromPlaylist(int index) |
void |
setAutoHideController(boolean autohide)
Sets the player to automatically hide its controls.
|
<C extends com.bramosystems.oss.player.core.client.ConfigParameter> |
setConfigParameter(C param,
Object value) |
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.
|
void |
setMatrix(com.bramosystems.oss.player.core.client.geom.TransformationMatrix matrix)
Sets the transformation matrix of the underlying Flash player.
|
void |
setPlayPosition(double position) |
void |
setRepeatMode(com.bramosystems.oss.player.core.client.RepeatMode mode) |
void |
setResizeToVideoSize(boolean resize) |
void |
setShuffleEnabled(boolean enable)
Enables or disables players' shuffle mode.
|
void |
setVolume(double volume) |
void |
stopMedia() |
addDebugHandler, addKeyDownHandler, addKeyPressHandler, addKeyUpHandler, addLoadingProgressHandler, addMediaInfoHandler, addMouseDownHandler, addMouseMoveHandler, addMouseUpHandler, addPlayerStateHandler, addPlayStateHandler, addToPlayerReadyCommandQueue, fireDebug, fireError, fireLoadingProgress, fireMediaInfoAvailable, firePlayerStateEvent, firePlayStateEvent, getRate, getWidgetFactory, isPlayerOnPage, removeFromPlayerReadyCommandQueue, setRate
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, removeFromParent, setLayoutData, sinkEvents
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, sinkBitlessEvent, toString, unsinkEvents
public FlashMediaPlayer(String mediaURL, boolean autoplay, String height, String width) throws com.bramosystems.oss.player.core.client.PluginNotFoundException, com.bramosystems.oss.player.core.client.PluginVersionException
FlashMediaPlayer
with the specified height
and
width
to playback media located at mediaURL
. Media playback
begins automatically if autoplay
is true
.
height
and width
are specified as CSS units. A value of null
for height
or width
puts the player in embedded mode. When in embedded mode,
the player is made invisible on the page and media state events are propagated to registered
listeners only. This is desired especially when used with custom sound controls. For custom
video-playback control, specify valid CSS values for height
and width
but hide the
player controls with setControllerVisible(false)
.
mediaURL
- the URL of the media to playbackautoplay
- true
to start playing automatically, false
otherwiseheight
- the height of the playerwidth
- the width of the player.com.bramosystems.oss.player.core.client.PluginVersionException
- if the required Flash plugin version is not installed on the client.com.bramosystems.oss.player.core.client.PluginNotFoundException
- if the Flash plugin is not installed on the client.public FlashMediaPlayer(String mediaURL) throws com.bramosystems.oss.player.core.client.PluginNotFoundException, com.bramosystems.oss.player.core.client.PluginVersionException
FlashMediaPlayer
to automatically playback media located at
mediaURL
.
Note: This constructor hides the video display component, the player controls are however visible.
mediaURL
- the URL of the media to playbackcom.bramosystems.oss.player.core.client.PluginVersionException
- if the required Flash plugin version is not installed on the client.com.bramosystems.oss.player.core.client.PluginNotFoundException
- if the Flash plugin is not installed on the client.public FlashMediaPlayer(String mediaURL, boolean autoplay) throws com.bramosystems.oss.player.core.client.PluginNotFoundException, com.bramosystems.oss.player.core.client.PluginVersionException
FlashMediaPlayer
to playback media located at mediaURL
.
Media playback begins automatically if autoplay
is true
.
Note: This constructor hides the video display component, the player controls are however visible.
mediaURL
- the URL of the media to playbackautoplay
- true
to start playing automatically, false
otherwisecom.bramosystems.oss.player.core.client.PluginVersionException
- if the required Flash plugin version is not installed on the client.com.bramosystems.oss.player.core.client.PluginNotFoundException
- if the Flash plugin is not installed on the client.protected void onLoad()
onLoad
in class com.google.gwt.user.client.ui.Widget
protected void onUnload()
onUnload
in class com.google.gwt.user.client.ui.Widget
public long getMediaDuration()
getMediaDuration
in class com.bramosystems.oss.player.core.client.AbstractMediaPlayer
public double getPlayPosition()
getPlayPosition
in class com.bramosystems.oss.player.core.client.AbstractMediaPlayer
public double getVolume()
getVolume
in class com.bramosystems.oss.player.core.client.AbstractMediaPlayer
public void loadMedia(String mediaURL) throws com.bramosystems.oss.player.core.client.LoadException
loadMedia
in class com.bramosystems.oss.player.core.client.AbstractMediaPlayer
com.bramosystems.oss.player.core.client.LoadException
public void pauseMedia()
pauseMedia
in class com.bramosystems.oss.player.core.client.AbstractMediaPlayer
public void playMedia() throws com.bramosystems.oss.player.core.client.PlayException
playMedia
in class com.bramosystems.oss.player.core.client.AbstractMediaPlayer
com.bramosystems.oss.player.core.client.PlayException
public void setPlayPosition(double position)
setPlayPosition
in class com.bramosystems.oss.player.core.client.AbstractMediaPlayer
public void setVolume(double volume)
setVolume
in class com.bramosystems.oss.player.core.client.AbstractMediaPlayer
public void stopMedia()
stopMedia
in class com.bramosystems.oss.player.core.client.AbstractMediaPlayer
public void setControllerVisible(boolean show)
setControllerVisible
in class com.bramosystems.oss.player.core.client.AbstractMediaPlayer
public boolean isControllerVisible()
isControllerVisible
in class com.bramosystems.oss.player.core.client.AbstractMediaPlayer
public int getLoopCount()
getLoopCount
in class com.bramosystems.oss.player.core.client.AbstractMediaPlayer
public void setLoopCount(int loop)
As of version 1.0, if this player is not available on the panel, this method call is added to the command-queue for later execution.
setLoopCount
in class com.bramosystems.oss.player.core.client.AbstractMediaPlayer
public void addToPlaylist(String mediaURL)
addToPlaylist
in interface com.bramosystems.oss.player.core.client.PlaylistSupport
public void addToPlaylist(com.bramosystems.oss.player.core.client.playlist.MRL mediaLocator)
addToPlaylist
in interface com.bramosystems.oss.player.core.client.PlaylistSupport
public void addToPlaylist(String... mediaURLs)
addToPlaylist
in interface com.bramosystems.oss.player.core.client.PlaylistSupport
public void addToPlaylist(List<com.bramosystems.oss.player.core.client.playlist.MRL> mediaLocators)
addToPlaylist
in interface com.bramosystems.oss.player.core.client.PlaylistSupport
public boolean isShuffleEnabled()
isShuffleEnabled
in interface com.bramosystems.oss.player.core.client.PlaylistSupport
public void removeFromPlaylist(int index)
removeFromPlaylist
in interface com.bramosystems.oss.player.core.client.PlaylistSupport
public void setShuffleEnabled(boolean enable)
As of version 1.0, if this player is not available on the panel, this method call is added to the command-queue for later execution.
setShuffleEnabled
in interface com.bramosystems.oss.player.core.client.PlaylistSupport
public void clearPlaylist()
clearPlaylist
in interface com.bramosystems.oss.player.core.client.PlaylistSupport
public int getPlaylistSize()
getPlaylistSize
in interface com.bramosystems.oss.player.core.client.PlaylistSupport
public void play(int index) throws IndexOutOfBoundsException
play
in interface com.bramosystems.oss.player.core.client.PlaylistSupport
IndexOutOfBoundsException
public void playNext() throws com.bramosystems.oss.player.core.client.PlayException
playNext
in interface com.bramosystems.oss.player.core.client.PlaylistSupport
com.bramosystems.oss.player.core.client.PlayException
public void playPrevious() throws com.bramosystems.oss.player.core.client.PlayException
playPrevious
in interface com.bramosystems.oss.player.core.client.PlaylistSupport
com.bramosystems.oss.player.core.client.PlayException
public int getVideoHeight()
getVideoHeight
in class com.bramosystems.oss.player.core.client.AbstractMediaPlayer
public int getVideoWidth()
getVideoWidth
in class com.bramosystems.oss.player.core.client.AbstractMediaPlayer
public void setResizeToVideoSize(boolean resize)
setResizeToVideoSize
in class com.bramosystems.oss.player.core.client.AbstractMediaPlayer
public boolean isResizeToVideoSize()
isResizeToVideoSize
in class com.bramosystems.oss.player.core.client.AbstractMediaPlayer
public void setMatrix(com.bramosystems.oss.player.core.client.geom.TransformationMatrix matrix)
If this player is not attached to a panel, this method call is added to the command-queue for later execution.
setMatrix
in interface com.bramosystems.oss.player.core.client.geom.MatrixSupport
public com.bramosystems.oss.player.core.client.geom.TransformationMatrix getMatrix()
getMatrix
in interface com.bramosystems.oss.player.core.client.geom.MatrixSupport
public <C extends com.bramosystems.oss.player.core.client.ConfigParameter> void setConfigParameter(C param, Object value)
setConfigParameter
in class com.bramosystems.oss.player.core.client.AbstractMediaPlayer
public com.bramosystems.oss.player.core.client.RepeatMode getRepeatMode()
getRepeatMode
in class com.bramosystems.oss.player.core.client.AbstractMediaPlayer
public void setRepeatMode(com.bramosystems.oss.player.core.client.RepeatMode mode)
setRepeatMode
in class com.bramosystems.oss.player.core.client.AbstractMediaPlayer
public void setAutoHideController(boolean autohide)
The auto-hide effect is active IF AND ONLY IF the controller is set visible
autohide
- true
to auto-hide the controller, false
otherwisepublic boolean isAutoHideController()
true
is the player autohides its controls, false
otherwiseCopyright © 2009-2013. All Rights Reserved.