public class NativePlayer
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 NativePlayer("www.example.com/mediafile.ogg");
} catch(PluginNotFoundException e) {
// PluginNotFoundException thrown if browser does not support HTML 5 specs.
player = PlayerUtil.getMissingPluginNotice(e.getPlugin());
}
panel.setWidget(player); // add player to panel.
Constructor and Description |
---|
NativePlayer(ArrayList<String> mediaSources,
boolean autoplay,
String height,
String width)
Constructs
NativePlayer with the specified height and
width to playback media located at any of the mediaSources . |
NativePlayer(String mediaURL)
Constructs
NativePlayer to playback media located at mediaURL . |
NativePlayer(String mediaURL,
boolean autoplay)
Constructs
NativePlayer to playback media located at mediaURL . |
NativePlayer(String mediaURL,
boolean autoplay,
String height,
String width)
Constructs
NativePlayer 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)
Adds the media at the specified URLs to the players' playlist.
|
void |
addToPlaylist(String mediaURL) |
void |
clearPlaylist() |
int |
getLoopCount() |
long |
getMediaDuration() |
int |
getPlaylistSize() |
double |
getPlayPosition() |
double |
getRate() |
com.bramosystems.oss.player.core.client.RepeatMode |
getRepeatMode() |
int |
getVideoHeight() |
int |
getVideoWidth() |
double |
getVolume() |
boolean |
isControllerVisible() |
boolean |
isResizeToVideoSize() |
boolean |
isShuffleEnabled() |
void |
loadMedia(String mediaURL) |
protected void |
onLoad()
Overriden to register player for DOM events.
|
void |
pauseMedia() |
void |
play(int index) |
void |
playMedia() |
void |
playNext() |
void |
playPrevious() |
void |
removeFromPlaylist(int index) |
<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 |
setPlayPosition(double position) |
void |
setRate(double rate) |
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, getWidgetFactory, isPlayerOnPage, removeFromPlayerReadyCommandQueue
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, onUnload, 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 NativePlayer(String mediaURL) throws com.bramosystems.oss.player.core.client.PluginNotFoundException
NativePlayer
to playback media located at mediaURL
.
Media playback begins automatically.
This is the same as calling NativePlayer(mediaURL, true, "20px", "100%")
mediaURL
- the URL of the media to playbackcom.bramosystems.oss.player.core.client.PluginNotFoundException
- if browser does not support the HTML 5 specification.public NativePlayer(String mediaURL, boolean autoplay) throws com.bramosystems.oss.player.core.client.PluginNotFoundException
NativePlayer
to playback media located at mediaURL
.
Media playback begins automatically if autoplay
is true
.
This is the same as calling NativePlayer(mediaURL, autoplay, "20px", "100%")
mediaURL
- the URL of the media to playbackautoplay
- true
to start playing automatically, false
otherwisecom.bramosystems.oss.player.core.client.PluginNotFoundException
- if browser does not support the HTML 5 specification.public NativePlayer(String mediaURL, boolean autoplay, String height, String width) throws com.bramosystems.oss.player.core.client.PluginNotFoundException
NativePlayer
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.
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.PluginNotFoundException
- if browser does not support the HTML 5 specification.public NativePlayer(ArrayList<String> mediaSources, boolean autoplay, String height, String width) throws com.bramosystems.oss.player.core.client.PluginNotFoundException
NativePlayer
with the specified height
and
width
to playback media located at any of the mediaSources
.
Playback begins automatically if autoplay
is true
.
As per the HTML 5 specification, the browser chooses any of the mediaSources
it supports
height
and width
are specified as CSS units.
mediaSources
- a list of media URLsautoplay
- true
to start playing automatically, false
otherwiseheight
- the height of the playerwidth
- the width of the player.com.bramosystems.oss.player.core.client.PluginNotFoundException
- if browser does not support the HTML 5 specification.protected void onLoad()
onLoad
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 int getLoopCount()
getLoopCount
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 boolean isControllerVisible()
isControllerVisible
in class com.bramosystems.oss.player.core.client.AbstractMediaPlayer
public boolean isResizeToVideoSize()
isResizeToVideoSize
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 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 void setResizeToVideoSize(boolean resize)
setResizeToVideoSize
in class com.bramosystems.oss.player.core.client.AbstractMediaPlayer
public void setRate(double rate)
setRate
in class com.bramosystems.oss.player.core.client.AbstractMediaPlayer
public double getRate()
getRate
in class com.bramosystems.oss.player.core.client.AbstractMediaPlayer
public 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(String... mediaURLs)
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 com.bramosystems.oss.player.core.client.PlaylistSupport
mediaURLs
- the alternative URLs of the same media (probably in different formats).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(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
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
Copyright © 2009-2013. All Rights Reserved.