|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecteu.webtoolkit.jwt.WObject
eu.webtoolkit.jwt.WWidget
eu.webtoolkit.jwt.WWebWidget
eu.webtoolkit.jwt.WInteractWidget
eu.webtoolkit.jwt.WAbstractMedia
public abstract class WAbstractMedia
Abstract baseclass for native media elements.
This class is an abstract base class for HTML5 media elements (<audio>, <video>).
| Nested Class Summary | |
|---|---|
static class |
WAbstractMedia.Options
Enumeration for playback options. |
static class |
WAbstractMedia.PreloadMode
Enumeration for preload strategy. |
static class |
WAbstractMedia.ReadyState
The HTML5 media ReadyState flag indicates how much of the media is loaded. |
| Constructor Summary | |
|---|---|
WAbstractMedia()
Consctructor for a media widget. |
|
WAbstractMedia(WContainerWidget parent)
Consctructor for a media widget. |
|
| Method Summary | |
|---|---|
void |
addSource(WLink link)
Add a media source. |
void |
addSource(WLink link,
java.lang.String type)
Add a media source. |
void |
addSource(WLink link,
java.lang.String type,
java.lang.String media)
Add a media source. |
void |
clearSources()
Removes all source elements. |
EventSignal |
ended()
Event signal emitted when the playback stopped because the end of the media was reached. |
java.lang.String |
getJsMediaRef()
Returns the JavaScript reference to the media object, or null. |
java.util.EnumSet<WAbstractMedia.Options> |
getOptions()
Retrieve the configured options. |
WAbstractMedia.PreloadMode |
getPreloadMode()
Retrieve the preload mode. |
WAbstractMedia.ReadyState |
getReadyState()
Returns the media's readyState. |
boolean |
isPlaying()
Returns whether the media is playing. |
void |
pause()
Invoke pause() on the media element. |
void |
play()
Invoke play() on the media element. |
EventSignal |
playbackPaused()
Event signal emitted when the playback has paused. |
EventSignal |
playbackStarted()
Event signal emitted when playback has begun. |
void |
remove()
Destructor. |
void |
setAlternativeContent(WWidget alternative)
Content to be shown when media cannot be played. |
void |
setOptions(java.util.EnumSet<WAbstractMedia.Options> flags)
Set the media element options. |
void |
setOptions(WAbstractMedia.Options flag,
WAbstractMedia.Options... flags)
Set the media element options. |
void |
setPreloadMode(WAbstractMedia.PreloadMode mode)
Set the preload mode. |
EventSignal |
timeUpdated()
Event signal emitted when the current playback position has changed. |
EventSignal |
volumeChanged()
Event signal emitted when the playback volume has changed. |
| Methods inherited from class eu.webtoolkit.jwt.WInteractWidget |
|---|
clicked, doubleClicked, enterPressed, escapePressed, gestureChanged, gestureEnded, gestureStarted, isEnabled, keyPressed, keyWentDown, keyWentUp, load, mouseDragged, mouseMoved, mouseWentDown, mouseWentOut, mouseWentOver, mouseWentUp, mouseWheel, propagateSetEnabled, setDraggable, setDraggable, setDraggable, setDraggable, touchEnded, touchMoved, touchStarted |
| Methods inherited from class eu.webtoolkit.jwt.WWidget |
|---|
acceptDrops, acceptDrops, addCssRule, addCssRule, addStyleClass, animateHide, animateShow, boxBorder, boxPadding, containsExposed, disable, dropEvent, enable, getDrop, getJsRef, getParent, hide, htmlText, isLayoutSizeAware, layoutSizeChanged, positionAt, positionAt, removeStyleClass, resize, setClearSides, 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 |
|---|
addChild, getObjectName, setObjectName |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WAbstractMedia(WContainerWidget parent)
A freshly constructed media widget has no options set, no media sources, and has preload mode set to PreloadAuto.
public WAbstractMedia()
Calls this((WContainerWidget)null)
| Method Detail |
|---|
public void remove()
WWidgetDeletes a widget and all children (recursively). If the widget is contained in another widget, it is removed first.
remove in class WInteractWidgetWContainerWidget.removeWidget(WWidget widget)public void setOptions(java.util.EnumSet<WAbstractMedia.Options> flags)
WAbstractMedia.Options
public final void setOptions(WAbstractMedia.Options flag,
WAbstractMedia.Options... flags)
Calls setOptions(EnumSet.of(flag,
flags))
public java.util.EnumSet<WAbstractMedia.Options> getOptions()
public void setPreloadMode(WAbstractMedia.PreloadMode mode)
public WAbstractMedia.PreloadMode getPreloadMode()
public void clearSources()
This method can be used to remove all media sources. Afterward, you may
add new media sources with calls to
addSource().
Use this to reuse a WAbstractMedia instantiation to play
something else.
public void addSource(WLink link,
java.lang.String type,
java.lang.String media)
This method specifies a media source (which may be a URL or dynamic resource). You may add as many media sources as you want. The browser will select the appropriate media stream to display to the user.
This method specifies a media source using the URL, the mime type, and the media attribute. HTML allows for empty type and media attributes.
public final void addSource(WLink link)
Calls addSource(link, "", "")
public final void addSource(WLink link,
java.lang.String type)
Calls addSource(link, type, "")
public void setAlternativeContent(WWidget alternative)
As not all browsers are HTML5 compliant, it is a good idea to provide fallback options when the media cannot be displayed. If the media can be played by the browser, the alternative content will be suppressed.
The two reasons to display the alternative content are (1) the media tag is not supported, or (2) the media tag is supported, but none of the media sources are supported by the browser. In the first case, fall-back is automatic and does not rely on JavaScript in the browser; in the latter case, JavaScript is required to make the fallback work.
The alternative content can be any widget: you can set it to an alternative media player (QuickTime, Flash, ...), show a Flash movie, an animated gif, a text, a poster image, ...
public void play()
play() on the media element.
JavaScript must be available for this function to work.
public void pause()
pause() on the media element.
JavaScript must be available for this function to work.
public boolean isPlaying()
public WAbstractMedia.ReadyState getReadyState()
public EventSignal playbackStarted()
This event fires when play was invoked, or when the media element starts playing because the Autoplay option was provided.
Note: When JavaScript is disabled, the signal will never fire.
public EventSignal playbackPaused()
Note: When JavaScript is disabled, the signal will never fire.
public EventSignal ended()
Note: When JavaScript is disabled, the signal will never fire.
public EventSignal timeUpdated()
This event is fired when the playback position has changed, both when the media is in a normal playing mode, but also when it has changed discontinuously because of another reason.
Note: When JavaScript is disabled, the signal will never fire.
public EventSignal volumeChanged()
Note: When JavaScript is disabled, the signal will never fire.
public java.lang.String getJsMediaRef()
It is possible, for browser compatibility reasons, that
WWidget#getJsRef() is not the media element.
getJsMediaRef() 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).
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||