com.bramosystems.oss.player.capsule.client
Class Capsule

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.CustomAudioPlayer
                      extended by com.bramosystems.oss.player.capsule.client.Capsule
All Implemented Interfaces:
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 Capsule
extends CustomAudioPlayer

Sample custom sound player.

Usage Example

 SimplePanel panel = new SimplePanel();   // create panel to hold the player
 Widget player = null;
 try {
      // create the player
      player = new Capsule("www.example.com/mediafile.wma");
 } 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
static interface Capsule.CapsuleUIResource
          Defines the CSS class names used by the Capsule widget.
 
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.bramosystems.oss.player.core.client.skin.CustomAudioPlayer
logger
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
Capsule(Plugin plugin, java.lang.String mediaURL, boolean autoplay)
          Constructs Capsule player to automatically playback the media located at mediaURL, if autoplay is true using the specified plugin.
Capsule(Plugin plugin, java.lang.String mediaURL, boolean autoplay, Capsule.CapsuleUIResource uiResource)
          Constructs Capsule player to automatically playback the media located at mediaURL, if autoplay is true using the specified plugin.
Capsule(java.lang.String mediaURL)
          Constructs Capsule player to automatically playback the media located at mediaURL.
Capsule(java.lang.String mediaURL, boolean autoplay)
          Constructs Capsule player to automatically playback the media located at mediaURL, if autoplay is true.
 
Method Summary
protected  void onUnload()
          Overridden to release resources.
 
Methods inherited from class com.bramosystems.oss.player.core.client.skin.CustomAudioPlayer
addToPlaylist, addToPlaylist, addToPlaylist, addToPlaylist, clearPlaylist, getLoopCount, getMediaDuration, getPlaylistSize, getPlayPosition, getRate, getRepeatMode, getVolume, initWidget, isShuffleEnabled, loadMedia, pauseMedia, play, playMedia, playNext, playPrevious, removeFromPlaylist, setConfigParameter, setConfigParameter, setConfigParameter, setLoopCount, setPlayerControlWidget, setPlayPosition, setRate, setRepeatMode, setShuffleEnabled, setVolume, showLogger, 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, getVideoHeight, getVideoWidth, getWidgetFactory, isControllerVisible, isPlayerOnPage, isResizeToVideoSize, removeFromPlayerReadyCommandQueue, setControllerVisible, setResizeToVideoSize
 
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, 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

Capsule

public Capsule(java.lang.String mediaURL)
        throws PluginNotFoundException,
               PluginVersionException,
               LoadException
Constructs Capsule player to automatically playback the media located at mediaURL.

Parameters:
mediaURL - the URL of the media to playback
Throws:
LoadException - if an error occurs while loading the media.
PluginVersionException - if the required plugin version is not installed on the client.
PluginNotFoundException - if the plugin is not installed on the client.

Capsule

public Capsule(java.lang.String mediaURL,
               boolean autoplay)
        throws PluginNotFoundException,
               PluginVersionException,
               LoadException
Constructs Capsule player to automatically playback the media located at mediaURL, if autoplay is true.

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

Capsule

public Capsule(Plugin plugin,
               java.lang.String mediaURL,
               boolean autoplay)
        throws PluginNotFoundException,
               PluginVersionException,
               LoadException
Constructs Capsule player to automatically playback the media located at mediaURL, if autoplay is true using the specified plugin.

This constructor uses the default CapsuleResourcePack to build the UI controls.

Parameters:
plugin - plugin to use for playback.
mediaURL - the URL of the media to playback
autoplay - true to start playing automatically, false otherwise
Throws:
LoadException - if an error occurs while loading the media.
PluginVersionException - if the required plugin version is not installed on the client.
PluginNotFoundException - if the plugin is not installed on the client.
See Also:
Plugin

Capsule

public Capsule(Plugin plugin,
               java.lang.String mediaURL,
               boolean autoplay,
               Capsule.CapsuleUIResource uiResource)
        throws PluginNotFoundException,
               PluginVersionException,
               LoadException
Constructs Capsule player to automatically playback the media located at mediaURL, if autoplay is true using the specified plugin.

Parameters:
plugin - plugin to use for playback.
mediaURL - the URL of the media to playback
autoplay - true to start playing automatically, false otherwise
uiResource - the CSS resource to use for the UI
Throws:
LoadException - if an error occurs while loading the media.
PluginVersionException - if the required plugin version is not installed on the client.
PluginNotFoundException - if the plugin is not installed on the client.
Since:
1.2
See Also:
Plugin
Method Detail

onUnload

protected void onUnload()
Overridden to release resources.

Overrides:
onUnload in class com.google.gwt.user.client.ui.Widget


Copyright © 2009-2011. All Rights Reserved.