public class DivXPlayer
extends com.bramosystems.oss.player.core.client.AbstractMediaPlayer
implements com.bramosystems.oss.player.core.client.PlaylistSupport
SimplePanel panel = new SimplePanel(); // create panel to hold the player
Widget player = null;
try {
// create the player
player = new DivXPlayer("www.example.com/mediafile.divx");
} 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.DivXPlayer, "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.
Modifier and Type | Class and Description |
---|---|
static class |
DivXPlayer.BufferingMode
An enum of buffering modes for DivXPlayer widget.
|
static class |
DivXPlayer.DisplayMode
An enum of display modes for DivXPlayer widget.
|
Constructor and Description |
---|
DivXPlayer(String mediaURL)
Constructs
DivXPlayer to automatically playback media located at
mediaURL using the default height of 90px and width of 100%. |
DivXPlayer(String mediaURL,
boolean autoplay)
Constructs
DivXPlayer to playback media located at mediaURL using the
default height of 90px and width of 100%. |
DivXPlayer(String mediaURL,
boolean autoplay,
String height,
String width)
Constructs
DivXPlayer to playback media located at mediaURL using the
default height of 90px and width of 100%. |
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() |
DivXPlayer.DisplayMode |
getDisplayMode()
Returns the skin mode of the player which is used to display playback controls.
|
int |
getLoopCount()
Returns the number of times this player repeats playback before stopping.
|
long |
getMediaDuration() |
int |
getPlaylistSize() |
double |
getPlayPosition() |
com.bramosystems.oss.player.core.client.RepeatMode |
getRepeatMode() |
int |
getVideoHeight() |
int |
getVideoWidth() |
double |
getVolume() |
boolean |
isControllerVisible()
Checks whether the player controls are visible.
|
boolean |
isResizeToVideoSize() |
boolean |
isShuffleEnabled() |
void |
loadMedia(String mediaURL) |
protected void |
onLoad()
Overridden to register player for plugin DOM events
|
protected void |
onUnload()
Overridden to release resources
|
void |
pauseMedia() |
void |
play(int index) |
void |
playMedia() |
void |
playNext() |
void |
playPrevious() |
void |
removeFromPlaylist(int index) |
void |
setAllowContextMenu(boolean allow)
Specify whether the player should display a contextual (right-click) menu
when the user presses the right mouse button or the menu buttons on the skin.
|
void |
setBannerEnabled(boolean enable)
Specifies whether the player should display the DivX advertisement banner
at the end of playback.
|
void |
setBufferingMode(DivXPlayer.BufferingMode mode)
Specify how the player should buffer downloaded data before attempting
to start playback.
|
void |
setControllerVisible(boolean show)
Displays or hides the player controls.
|
void |
setDisplayMode(DivXPlayer.DisplayMode mode)
Specifies which skin mode the player should use to display playback controls.
|
void |
setLoopCount(int loop)
Sets the number of times the current media file should repeat playback before stopping.
|
void |
setPlayPosition(double position) |
void |
setPreview(String imageURL,
String message,
int messageFontSize)
Specifies an image, text and text size to use as a preview for the video.
|
void |
setRepeatMode(com.bramosystems.oss.player.core.client.RepeatMode mode) |
void |
setResizeToVideoSize(boolean resize) |
void |
setShuffleEnabled(boolean enable) |
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, setConfigParameter, 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 DivXPlayer(String mediaURL, boolean autoplay, String height, String width) throws com.bramosystems.oss.player.core.client.PluginNotFoundException, com.bramosystems.oss.player.core.client.PluginVersionException
DivXPlayer
to playback media located at mediaURL
using the
default height of 90px and width of 100%. Media playback begins automatically if
autoplay
is true
.mediaURL
- the URL of the media to playbackautoplay
- true
to play playing automatically, false
otherwiseheight
- the height of the playerwidth
- the width of the player.com.bramosystems.oss.player.core.client.PluginVersionException
- if the required DivX® Web Player plugin version is not installed on the client.com.bramosystems.oss.player.core.client.PluginNotFoundException
- if DivX® Web Player plugin is not installed on the client.public DivXPlayer(String mediaURL, boolean autoplay) throws com.bramosystems.oss.player.core.client.PluginNotFoundException, com.bramosystems.oss.player.core.client.PluginVersionException
DivXPlayer
to playback media located at mediaURL
using the
default height of 90px and width of 100%. Media playback begins automatically if
autoplay
is true
.mediaURL
- the URL of the media to playbackautoplay
- true
to play playing automatically, false
otherwisecom.bramosystems.oss.player.core.client.PluginVersionException
- if the required DivX® Web Player plugin version is not installed on the client.com.bramosystems.oss.player.core.client.PluginNotFoundException
- if DivX® Web Player plugin is not installed on the client.public DivXPlayer(String mediaURL) throws com.bramosystems.oss.player.core.client.PluginNotFoundException, com.bramosystems.oss.player.core.client.PluginVersionException
DivXPlayer
to automatically playback media located at
mediaURL
using the default height of 90px and width of 100%.
This is the same as calling DivXPlayer(mediaURL, true, "90px", "100%")
mediaURL
- the URL of the media to playbackcom.bramosystems.oss.player.core.client.PluginVersionException
- if the required DivX® Web Player plugin version is not installed on the client.com.bramosystems.oss.player.core.client.PluginNotFoundException
- if DivX® Web Player plugin is not installed on the client.protected final 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 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 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 stopMedia()
stopMedia
in class com.bramosystems.oss.player.core.client.AbstractMediaPlayer
public void pauseMedia()
pauseMedia
in class com.bramosystems.oss.player.core.client.AbstractMediaPlayer
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 void setPlayPosition(double position)
setPlayPosition
in class com.bramosystems.oss.player.core.client.AbstractMediaPlayer
public double getVolume()
getVolume
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 setControllerVisible(boolean show)
If this player is not available on the panel, this method call is added to the command-queue for later execution.
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)
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 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 setBannerEnabled(boolean enable)
If this player is not available on the panel, this method call is added to the command-queue for later execution.
enable
- true
to enable, false
otherwisepublic void setAllowContextMenu(boolean allow)
If this player is not available on the panel, this method call is added to the command-queue for later execution.
allow
- true
to allow, false
otherwisepublic void setBufferingMode(DivXPlayer.BufferingMode mode)
If this player is not available on the panel, this method call is added to the command-queue for later execution.
mode
- the modepublic void setDisplayMode(DivXPlayer.DisplayMode mode)
If this player is not available on the panel, this method call is added to the command-queue for later execution.
mode
- the display modepublic DivXPlayer.DisplayMode getDisplayMode()
public void setPreview(String imageURL, String message, int messageFontSize)
The image file which should be in PNG, JPEG or GIF format is used as a preview
image and is displayed in place of the DivX® logo. The message
is
displayed on top of the image at the size specified by messageFontSize
.
Note: autoplay
should be set to false
for this method to
take effect.
If this player is not available on the panel, this method call is added to the command-queue for later execution.
imageURL
- the URL of the preview imagemessage
- the text displayed on top of the imagemessageFontSize
- the font size of the displayed textpublic void setShuffleEnabled(boolean enable)
setShuffleEnabled
in interface com.bramosystems.oss.player.core.client.PlaylistSupport
public boolean isShuffleEnabled()
isShuffleEnabled
in interface com.bramosystems.oss.player.core.client.PlaylistSupport
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 void removeFromPlaylist(int index)
removeFromPlaylist
in interface com.bramosystems.oss.player.core.client.PlaylistSupport
public void clearPlaylist()
clearPlaylist
in interface com.bramosystems.oss.player.core.client.PlaylistSupport
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 void play(int index) throws IndexOutOfBoundsException
play
in interface com.bramosystems.oss.player.core.client.PlaylistSupport
IndexOutOfBoundsException
public int getPlaylistSize()
getPlaylistSize
in interface com.bramosystems.oss.player.core.client.PlaylistSupport
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
Copyright © 2009-2013. All Rights Reserved.