Class WVideo
- java.lang.Object
-
public class WVideo extends WAbstractMedia
A video-playing widget.This is a low-level widget, mapping directly onto a
<video>element available in HTML5 compliant browsers.In almost every situation you should use the
WMediaPlayerwidget instead, which has fallback and flexible user-interface options.Usage of the video element consists of adding one or more video sources and setting some options. Since not every browser supports HTML5 video, the class provides a mechanism to display alternative content in browsers that cannot play the video.
There are two reasons why the a browser may use the alternative content: either because the browser does not support the HTML5 video tag (alternative content is displayed even when JavaScript is not available), or because none of the specified sources contain a video format that is understood by the browser (requires JavaScript to display the alternative content).
The
WAbstractMedia#addSource()andWAbstractMedia#setAlternativeContent()may not be called after the widget is rendered.- See Also:
WMediaPlayer
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WObject
WObject.FormData
-
-
Field Summary
-
Fields inherited from class eu.webtoolkit.jwt.WInteractWidget
dragTouchEndSlot_, dragTouchSlot_, noDefault
-
Fields inherited from class eu.webtoolkit.jwt.WWidget
WT_GETEXTRAMS_JS
-
-
Constructor Summary
Constructors Constructor Description WVideo()Creates a video widget.WVideo(WContainerWidget parentContainer)Creates a video widget.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetJsVideoRef()Returns the JavaScript reference to the video object, or null.voidresize(WLength width, WLength height)Resizes the widget.voidsetPoster(java.lang.String url)Set the poster image.-
Methods inherited from class eu.webtoolkit.jwt.WAbstractMedia
addSource, addSource, addSource, clearSources, createDomElement, enableAjax, ended, getDomChanges, getJsMediaRef, getOptions, getPreloadMode, getReadyState, isPlaying, iterateChildren, pause, play, playbackPaused, playbackStarted, remove, setAlternativeContent, setFormData, setOptions, setOptions, setPreloadMode, timeUpdated, volumeChanged
-
Methods inherited from class eu.webtoolkit.jwt.WInteractWidget
clicked, doubleClicked, enterPressed, escapePressed, gestureChanged, gestureEnded, gestureStarted, getMouseOverDelay, isEnabled, keyPressed, keyWentDown, keyWentUp, load, mouseDragged, mouseMoved, mouseWentDown, mouseWentOut, mouseWentOver, mouseWentUp, mouseWheel, propagateSetEnabled, render, setDraggable, setDraggable, setDraggable, setDraggable, setMouseOverDelay, setPopup, touchEnded, touchMoved, touchStarted, unsetDraggable
-
Methods inherited from class eu.webtoolkit.jwt.WWebWidget
addStyleClass, beingDeleted, blurred, callJavaScriptMember, childrenChanged, doJavaScript, escapeText, escapeText, escapeText, escapeText, find, findById, focussed, getAttributeValue, getBaseZIndex, getChildren, getClearSides, getDecorationStyle, getFloatSide, getHeight, getHtmlTagName, getId, getJavaScriptMember, getLineHeight, getMargin, getMaximumHeight, getMaximumWidth, getMinimumHeight, getMinimumWidth, getOffset, getPositionScheme, getScrollVisibilityMargin, getStyleClass, getTabIndex, getToolTip, getVerticalAlignment, getVerticalAlignmentLength, getWidth, hasFocus, hasStyleClass, hideToolTip, isCanReceiveFocus, isDisabled, isHidden, isHiddenKeepsGeometry, isInline, isLoaded, isPopup, isRendered, isScrollVisibilityEnabled, isScrollVisible, isSetFirstFocus, isThemeStyleEnabled, isVisible, jsStringLiteral, jsStringLiteral, manageWidget, parentResized, parentResized, propagateSetVisible, refresh, removeScript, removeStyleClass, scrollVisibilityChanged, setAttributeValue, setBaseZIndex, setCanReceiveFocus, setClearSides, setDecorationStyle, setDeferredToolTip, setDisabled, setFlexBox, setFloatSide, setFocus, setHidden, setHiddenKeepsGeometry, setHtmlTagName, setId, setInline, setJavaScriptMember, setLineHeight, setLoadLaterWhenInvisible, setMargin, setMaximumSize, setMinimumSize, setObjectName, setOffsets, setParentWidget, setPositionScheme, setScrollVisibilityEnabled, setScrollVisibilityMargin, setSelectable, setStyleClass, setTabIndex, setThemeStyleEnabled, setToolTip, setVerticalAlignment, showToolTip, showToolTipOnHover, unescapeText, updateSignalConnection, voidEventSignal, widgetAdded, widgetRemoved
-
Methods inherited from class eu.webtoolkit.jwt.WWidget
acceptDrops, acceptDrops, addCssRule, addCssRule, addJSignal, addStyleClass, animateHide, animateShow, applyThemeStyles, boxBorder, boxPadding, createJavaScript, disable, dropEvent, enable, getDropTouch, getJsRef, getParent, hide, htmlText, isExposed, isGlobalWidget, isLayoutSizeAware, layoutSizeChanged, needsRerender, positionAt, positionAt, positionAt, positionAt, removeFromParent, removeStyleClass, removeWidget, render, resize, scheduleRender, scheduleRender, scheduleRender, scheduleThemeStyleApply, setClearSides, setDeferredToolTip, setFocus, setHeight, setHidden, setLayoutSizeAware, setMargin, setMargin, setMargin, setMargin, setMargin, setOffsets, setOffsets, setOffsets, setOffsets, setOffsets, setToolTip, setVerticalAlignment, setWidth, show, stopAcceptDrops, toggleStyleClass, toggleStyleClass, tr
-
Methods inherited from class eu.webtoolkit.jwt.WObject
getObjectName
-
-
-
-
Constructor Detail
-
WVideo
public WVideo(WContainerWidget parentContainer)
Creates a video widget.The constructor sets the 'controls' option, which causes the browser to display a bar with play/pauze/volume/... controls.
A freshly constructed video widget has no poster image, no media sources, has preload mode set to PreloadAuto, and only the Controls flag is set.
-
WVideo
public WVideo()
Creates a video widget.
-
-
Method Detail
-
setPoster
public void setPoster(java.lang.String url)
Set the poster image.On browsers that support it, the poster image is displayed before the video is playing. Some browsers display the first frame of the video stream once the video stream is loaded; it is therefore a good idea to include the poster image as first frame in the video feed too.
-
getJsVideoRef
public java.lang.String getJsVideoRef()
Returns the JavaScript reference to the video object, or null.It is possible, for compatibility reasons, that
WWidget.getJsRef()is not the video element.getJsVideoRef()is guaranteed to be an expression that evaluates to the video object. This expression may yield null, if the video object is not rendered at all (e.g. on older versions of Internet Explorer).
-
resize
public void resize(WLength width, WLength height)
Description copied from class:WWidgetResizes the widget.Specifies a fixed size for this widget, setting CSS
widthandheightproperties. By default a widget has automatic width and height, which sets a size for the widget following CSS rules.When the widget is not managed by a layout manager, the automatic (natural) size of a widget depends on whether the widget is a block or inline widget:
- a block widget takes by default the width of the parent, and the height that it needs based on its contents
- an inline widget takes the width and height that it needs based on its contents (possibly wrapping over multiple lines). The width and height of an inline widget cannot be changed (by the letter of CSS, although most browsers will react to it in varying ways).
When inserted in a layout manager, the size set will be used as a widget's preferred size, but the widget may be given a different size by the layout manager based on available space and stretch factors. The actual size given by a layout manager may be retrieved by making the widget "layout size aware", using
setLayoutSizeAware(). If you have defined a"wtResize()"JavaScript method for the widget, then this method will also be called.The default width and height of a widget is
WLength.Auto.- Overrides:
resizein classWWebWidget- See Also:
WWidget.getWidth(),WWidget.getHeight()
-
-