public class YouTubePlayer extends YouTubeBasePlayer
SimplePanel panel = new SimplePanel(); // create panel to hold the player
Widget player = null;
try {
// create the player
player = new YouTubePlayer("VIDEO_ID", "100%", "350px");
} 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(e.getPlugin());
} 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.
YouTubeBasePlayer.DefaultEventHandler
_height, _vid, _width, configParam, impl, playerId, pParams
Constructor and Description |
---|
YouTubePlayer(String videoID,
String width,
String height)
Constructs
YouTubePlayer with the specified height and
width to playback video with videoID |
Modifier and Type | Method and Description |
---|---|
protected String |
getNormalizedVideoAppURL(String videoID,
PlayerParameters playerParameters)
Returns the normalized URL of the video.
|
protected String |
getPlayerName() |
protected void |
onLoad() |
protected void |
onUnload() |
addPlaybackQualityChangeHandler, getAvailableQualityLevels, getLoopCount, getMediaDuration, getPlaybackQuality, getPlayPosition, getProvider, getRepeatMode, getVolume, isControllerVisible, loadMedia, paramsToString, pauseMedia, playMedia, setConfigParameter, setLoopCount, setPlaybackQuality, setPlayPosition, setRepeatMode, setVolume, stopMedia
addDebugHandler, addKeyDownHandler, addKeyPressHandler, addKeyUpHandler, addLoadingProgressHandler, addMediaInfoHandler, addMouseDownHandler, addMouseMoveHandler, addMouseUpHandler, addPlayerStateHandler, addPlayStateHandler, addToPlayerReadyCommandQueue, fireDebug, fireError, fireLoadingProgress, fireMediaInfoAvailable, firePlayerStateEvent, firePlayStateEvent, getRate, getVideoHeight, getVideoWidth, getWidgetFactory, isPlayerOnPage, isResizeToVideoSize, removeFromPlayerReadyCommandQueue, setControllerVisible, setRate, setResizeToVideoSize
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 YouTubePlayer(String videoID, String width, String height) throws com.bramosystems.oss.player.core.client.PluginNotFoundException, com.bramosystems.oss.player.core.client.PluginVersionException
YouTubePlayer
with the specified height
and
width
to playback video with videoID
height
and width
are specified as CSS units.
videoID
- the ID of the videowidth
- the width of the playerheight
- the height of the playercom.bramosystems.oss.player.core.client.PluginNotFoundException
- if the required Flash player plugin is not foundcom.bramosystems.oss.player.core.client.PluginVersionException
- if the required Flash plugin version is not foundNullPointerException
- if either videoID
, height
or
width
is nullprotected 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
protected String getNormalizedVideoAppURL(String videoID, PlayerParameters playerParameters)
This method is called by the player Constructors. It adjusts the
parameters that may be present in the
playerParameters
(possibly overriding some) to match the
requirements of this players' internals.
videoID
- the ID of the YouTube™ videoplayerParameters
- the parameters of the videoprotected String getPlayerName()
Copyright © 2009-2013. All Rights Reserved.