com.bramosystems.oss.player.flat.client
Class FlatVideoPlayer

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.Composite
              extended by com.bramosystems.oss.player.core.client.AbstractMediaPlayer
                  extended by com.bramosystems.oss.player.core.client.skin.CustomVideoPlayer
                      extended by com.bramosystems.oss.player.flat.client.FlatVideoPlayer
All Implemented Interfaces:
MatrixSupport, PlaylistSupport, HasMediaMessageHandlers, HasMediaProgressHandlers, HasMediaStateHandlers, HasPlayStateHandlers, com.google.gwt.event.dom.client.HasKeyDownHandlers, com.google.gwt.event.dom.client.HasKeyPressHandlers, com.google.gwt.event.dom.client.HasKeyUpHandlers, com.google.gwt.event.dom.client.HasMouseDownHandlers, com.google.gwt.event.dom.client.HasMouseMoveHandlers, com.google.gwt.event.dom.client.HasMouseUpHandlers, com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.IsWidget

public class FlatVideoPlayer
extends CustomVideoPlayer

Custom video player implementation using CustomPlayerControl

Usage Example

 SimplePanel panel = new SimplePanel();   // create panel to hold the player
 Widget player = null;
 try {
      // create the player
      player = new FlatVideoPlayer("www.example.com/videofile.mp4", false, "150px", "100%");
 } catch(LoadException e) {
      // catch loading exception and alert user
      Window.alert("An error occured while loading");
 } catch(PluginVersionException e) {
      // catch plugin version exception and alert user, possibly providing a link
      // to the plugin download page.
      player = new HTML(".. some nice message telling the user to download plugin first ..");
 } 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.
 

Author:
Sikirulai Braheem

Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
FlatVideoPlayer(Plugin plugin, String mediaURL, boolean autoplay, String height, String width)
          Constructs FlatVideoPlayer player with the specified height and width to playback media located at mediaURL using the specified media plugin.
FlatVideoPlayer(String mediaURL, boolean autoplay, String height, String width)
          Constructs FlatVideoPlayer player with the specified height and width to playback media located at mediaURL using a dynamically determined plugin.
 
Method Summary
protected  void onVideoDimensionChanged(int width, int height)
          Called when the size of the embedded player changes to match the dimension of the media (especially video)
 void showLogger(boolean enable)
          Displays or hides the players' logger widget.
 
Methods inherited from class com.bramosystems.oss.player.core.client.skin.CustomVideoPlayer
addToPlaylist, addToPlaylist, addToPlaylist, addToPlaylist, clearPlaylist, getLoopCount, getMatrix, getMediaDuration, getPlaylistSize, getPlayPosition, getRate, getRepeatMode, getVideoHeight, getVideoWidth, getVolume, initWidget, isControllerVisible, isResizeToVideoSize, isShuffleEnabled, loadMedia, pauseMedia, play, playMedia, playNext, playPrevious, removeFromPlaylist, setConfigParameter, setConfigParameter, setConfigParameter, setControllerVisible, setLoopCount, setMatrix, setPlayerControlWidget, setPlayPosition, setRate, setRepeatMode, setResizeToVideoSize, setShuffleEnabled, setVolume, stopMedia
 
Methods inherited from class com.bramosystems.oss.player.core.client.AbstractMediaPlayer
addDebugHandler, addKeyDownHandler, addKeyPressHandler, addKeyUpHandler, addLoadingProgressHandler, addMediaInfoHandler, addMouseDownHandler, addMouseMoveHandler, addMouseUpHandler, addPlayerStateHandler, addPlayStateHandler, addToPlayerReadyCommandQueue, fireDebug, fireError, fireLoadingProgress, fireMediaInfoAvailable, firePlayerStateEvent, firePlayStateEvent, getWidgetFactory, isPlayerOnPage, removeFromPlayerReadyCommandQueue
 
Methods inherited from class com.google.gwt.user.client.ui.Composite
getWidget, isAttached, onAttach, onBrowserEvent, onDetach, setWidget
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
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, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
 

Constructor Detail

FlatVideoPlayer

public FlatVideoPlayer(Plugin plugin,
                       String mediaURL,
                       boolean autoplay,
                       String height,
                       String width)
                throws PluginNotFoundException,
                       PluginVersionException,
                       LoadException
Constructs FlatVideoPlayer player with the specified height and width to playback media located at mediaURL using the specified media plugin. Media playback begins automatically if autoplay is true.

height and width are specified as CSS units. A minimum value of 20px should be specified for height to enable a proper display of the controls.

Parameters:
mediaURL - the URL of the media to playback
autoplay - true to start playing automatically, false otherwise
height - the height of the player
width - the width of the player.
Throws:
LoadException - if an error occurs while loading the media.
PluginVersionException - if the required player plugin version is not installed on the client.
PluginNotFoundException - if the player plugin is not installed on the client.
NullPointerException - if height or width is null

FlatVideoPlayer

public FlatVideoPlayer(String mediaURL,
                       boolean autoplay,
                       String height,
                       String width)
                throws PluginNotFoundException,
                       PluginVersionException,
                       LoadException
Constructs FlatVideoPlayer player with the specified height and width to playback media located at mediaURL using a dynamically determined plugin. Media playback begins automatically if autoplay is true.

This is the same as calling FlatVideoPlayer(Plugin.Auto, mediaURL, autoplay, height, width)

height and width are specified as CSS units. A minimum value of 20px should be specified for height to enable a proper display of the controls.

Parameters:
mediaURL - the URL of the media to playback
autoplay - true to start playing automatically, false otherwise
height - the height of the player
width - the width of the player.
Throws:
LoadException - if an error occurs while loading the media.
PluginVersionException - if the required player plugin version is not installed on the client.
PluginNotFoundException - if the player plugin is not installed on the client.
NullPointerException - if height or width is null
Method Detail

showLogger

public void showLogger(boolean enable)
Description copied from class: AbstractMediaPlayer
Displays or hides the players' logger widget. The logger widget logs debug messages which can be useful during development.

Overrides:
showLogger in class CustomVideoPlayer
Parameters:
enable - true to make the logger widget visible, false otherwise.
See Also:
Logger

onVideoDimensionChanged

protected void onVideoDimensionChanged(int width,
                                       int height)
Description copied from class: CustomVideoPlayer
Called when the size of the embedded player changes to match the dimension of the media (especially video)

This method is called whenever the PlayerStateEvent event is fired with State.DimensionChangedOnVideo state.

Specified by:
onVideoDimensionChanged in class CustomVideoPlayer
Parameters:
width - the width of the media (in pixels)
height - the height of the media (in pixels)


Copyright © 2009-2011. All Rights Reserved.