Class WAudio
This is a low-level widget, mapping directly onto a <audio>
element
available in HTML5 compliant browsers.
In almost every situation you should use the WMediaPlayer
widget if you want the user
to be able to interact with the audio, or WSound
for simple sound feed-back.
Usage of the audio element consists of adding one or more audio sources and setting some options. Since not every browser supports HTML5 audio, 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 audio tag (alternative content is displayed even when JavaScript is not available), or because none of the specified sources contain an audio format that is understood by the browser (requires JavaScript to display the alternative content).
The WAbstractMedia#addSource()
and WAbstractMedia#setAlternativeContent()
may not be called after the widget is rendered.
- See Also:
-
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_
-
Constructor Summary
ConstructorDescriptionWAudio()
Creates a audio widget.WAudio
(WContainerWidget parentContainer) Creates a audio widget. -
Method Summary
Modifier and TypeMethodDescriptionReturns the JavaScript reference to the audio object, or null.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, 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, isCanReceiveFocus, isDisabled, isHidden, isHiddenKeepsGeometry, isInline, isLoaded, isPopup, isRendered, isScrollVisibilityEnabled, isScrollVisible, isSetFirstFocus, isThemeStyleEnabled, isVisible, jsStringLiteral, jsStringLiteral, manageWidget, parentResized, parentResized, propagateSetVisible, refresh, removeScript, removeStyleClass, render, resize, 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, unescapeText, updateSignalConnection, voidEventSignal, widgetAdded, widgetRemoved
Methods inherited from class eu.webtoolkit.jwt.WWidget
acceptDrops, acceptDrops, addCssRule, addCssRule, addJSignal, addStyleClass, animateHide, animateShow, boxBorder, boxPadding, createJavaScript, disable, dropEvent, enable, getDropTouch, getJsRef, getParent, hide, htmlText, isExposed, isGlobalWidget, isLayoutSizeAware, layoutSizeChanged, needsRerender, positionAt, positionAt, removeFromParent, removeStyleClass, removeWidget, render, resize, scheduleRender, scheduleRender, scheduleRender, 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 Details
-
WAudio
Creates a audio widget.A freshly constructed Audio widget has no media sources, no options, and has preload mode set to PreloadAuto.
-
WAudio
public WAudio()Creates a audio widget.
-
-
Method Details
-
getJsAudioRef
Returns the JavaScript reference to the audio object, or null.It is possible, for browser compatibility reasons, that
WWidget.getJsRef()
is not the HTML5 audio element.getJsAudioRef()
is guaranteed to be an expression that evaluates to the media object. This expression may yield null, if the video object is not rendered at all (e.g. on older versions of Internet Explorer).
-