com.vaadin.ui
Class AbstractMedia

java.lang.Object
  extended by com.vaadin.terminal.AbstractClientConnector
      extended by com.vaadin.ui.AbstractComponent
          extended by com.vaadin.ui.AbstractMedia
All Implemented Interfaces:
MethodEventSource, Connector, ClientConnector, RpcTarget, Sizeable, Component, Serializable
Direct Known Subclasses:
Audio, Video

public abstract class AbstractMedia
extends AbstractComponent

Abstract base class for the HTML5 media components.

Author:
Vaadin Ltd
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.vaadin.ui.AbstractComponent
AbstractComponent.ComponentErrorEvent, AbstractComponent.ComponentErrorHandler
 
Nested classes/interfaces inherited from interface com.vaadin.ui.Component
Component.ErrorEvent, Component.ErrorListener, Component.Event, Component.Focusable, Component.Listener
 
Nested classes/interfaces inherited from interface com.vaadin.terminal.Sizeable
Sizeable.Unit
 
Field Summary
 
Fields inherited from interface com.vaadin.terminal.Sizeable
SIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS
 
Constructor Summary
AbstractMedia()
           
 
Method Summary
 void addSource(Resource source)
          Adds an alternative media file to the sources list.
 String getAltText()
           
 List<Resource> getSources()
           
 AbstractMediaState getState()
          Returns the shared state bean with information to be sent from the server to the client.
 boolean isAutoplay()
           
 boolean isHtmlContentAllowed()
           
 boolean isMuted()
           
 boolean isShowControls()
           
 void pause()
          Pauses the media.
 void play()
          Starts playback of the media.
 void setAltText(String altText)
          Sets the alternative text to be displayed if the browser does not support HTML5.
 void setAutoplay(boolean autoplay)
          Sets whether the media is to automatically start playback when enough data has been loaded.
 void setHtmlContentAllowed(boolean htmlContentAllowed)
          Set whether the alternative text (setAltText(String)) is rendered as HTML or not.
 void setMuted(boolean muted)
          Set whether to mute the audio or not.
 void setShowControls(boolean showControls)
          Sets whether or not the browser should show native media controls.
 void setSource(Resource source)
          Sets a single media file as the source of the media component.
 void setSources(Resource... sources)
          Set multiple sources at once.
 
Methods inherited from class com.vaadin.ui.AbstractComponent
addListener, addListener, addListener, addListener, addShortcutListener, addStyleName, attach, detach, findAncestor, fireComponentErrorEvent, fireComponentEvent, fireEvent, focus, getActionManager, getApplication, getCaption, getComponentError, getData, getDebugId, getDescription, getErrorHandler, getErrorMessage, getHeight, getHeightUnits, getIcon, getListeners, getLocale, getParent, getRoot, getStyle, getStyleName, getWidth, getWidthUnits, handleError, hasListeners, isConnectorEnabled, isEnabled, isImmediate, isReadOnly, isVisible, removeListener, removeListener, removeListener, removeListener, removeListener, removeShortcutListener, removeStyleName, requestRepaint, setCaption, setComponentError, setData, setDebugId, setDescription, setEnabled, setErrorHandler, setHeight, setHeight, setIcon, setImmediate, setLocale, setParent, setReadOnly, setSizeFull, setSizeUndefined, setStyle, setStyleName, setVisible, setWidth, setWidth, updateState
 
Methods inherited from class com.vaadin.terminal.AbstractClientConnector
addExtension, addMethodInvocationToQueue, createState, getAllChildrenIterable, getConnectorId, getExtensions, getRpcManager, getRpcProxy, getStateType, registerRpc, registerRpc, removeExtension, requestRepaintAll, retrievePendingRpcCalls
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.vaadin.terminal.gwt.server.ClientConnector
getExtensions, getStateType, removeExtension, requestRepaintAll, retrievePendingRpcCalls
 
Methods inherited from interface com.vaadin.terminal.gwt.client.Connector
getConnectorId
 
Methods inherited from interface com.vaadin.terminal.gwt.server.RpcTarget
getRpcManager
 

Constructor Detail

AbstractMedia

public AbstractMedia()
Method Detail

getState

public AbstractMediaState getState()
Description copied from class: AbstractComponent
Returns the shared state bean with information to be sent from the server to the client. Subclasses should override this method and set any relevant fields of the state returned by super.getState().

Specified by:
getState in interface Connector
Specified by:
getState in interface Component
Overrides:
getState in class AbstractComponent
Returns:
updated component shared state

setSource

public void setSource(Resource source)
Sets a single media file as the source of the media component.

Parameters:
source -

addSource

public void addSource(Resource source)
Adds an alternative media file to the sources list. Which of the sources is used is selected by the browser depending on which file formats it supports. See wikipedia for a table of formats supported by different browsers.

Parameters:
source -

setSources

public void setSources(Resource... sources)
Set multiple sources at once. Which of the sources is used is selected by the browser depending on which file formats it supports. See wikipedia for a table of formats supported by different browsers.

Parameters:
sources -

getSources

public List<Resource> getSources()
Returns:
The sources pointed to in this media.

setShowControls

public void setShowControls(boolean showControls)
Sets whether or not the browser should show native media controls.

Parameters:
showControls -

isShowControls

public boolean isShowControls()
Returns:
true if the browser is to show native media controls.

setAltText

public void setAltText(String altText)
Sets the alternative text to be displayed if the browser does not support HTML5. This text is rendered as HTML if setHtmlContentAllowed(boolean) is set to true. With HTML rendering, this method can also be used to implement fallback to a flash-based player, see the Mozilla Developer Network for details.

Parameters:
altText -

getAltText

public String getAltText()
Returns:
The text/html that is displayed when a browser doesn't support HTML5.

setHtmlContentAllowed

public void setHtmlContentAllowed(boolean htmlContentAllowed)
Set whether the alternative text (setAltText(String)) is rendered as HTML or not.

Parameters:
htmlContentAllowed -

isHtmlContentAllowed

public boolean isHtmlContentAllowed()
Returns:
true if the alternative text (setAltText(String)) is to be rendered as HTML.

setAutoplay

public void setAutoplay(boolean autoplay)
Sets whether the media is to automatically start playback when enough data has been loaded.

Parameters:
autoplay -

isAutoplay

public boolean isAutoplay()
Returns:
true if the media is set to automatically start playback.

setMuted

public void setMuted(boolean muted)
Set whether to mute the audio or not.

Parameters:
muted -

isMuted

public boolean isMuted()
Returns:
true if the audio is muted.

pause

public void pause()
Pauses the media.


play

public void play()
Starts playback of the media.



Copyright © 2000-2011 Vaadin Ltd. All Rights Reserved.