public class MediaElement extends Element
| Modifier and Type | Field and Description | 
|---|---|
| static java.lang.String | CAN_PLAY_MAYBEConstant returned from  canPlayType(String). | 
| static java.lang.String | CAN_PLAY_PROBABLYConstant returned from  canPlayType(String). | 
| static java.lang.String | CANNOT_PLAYConstant returned from  canPlayType(String). | 
| static int | HAVE_CURRENT_DATAConstant returned from  getReadyState(). | 
| static int | HAVE_ENOUGH_DATAConstant returned from  getReadyState(). | 
| static int | HAVE_FUTURE_DATAConstant returned from  getReadyState(). | 
| static int | HAVE_METADATAConstant returned from  getReadyState(). | 
| static int | HAVE_NOTHINGConstant returned from  getReadyState(). | 
| static int | NETWORK_EMPTYConstant returned from  getNetworkState(). | 
| static int | NETWORK_IDLEConstant returned from  getNetworkState(). | 
| static int | NETWORK_LOADINGConstant returned from  getNetworkState(). | 
| static int | NETWORK_NO_SOURCEConstant returned from  getNetworkState(). | 
| static java.lang.String | PRELOAD_AUTOConstant used by  getPreload()andsetPreload(String). | 
| static java.lang.String | PRELOAD_METADATAConstant used by  getPreload()andsetPreload(String). | 
| static java.lang.String | PRELOAD_NONEConstant used by  getPreload()andsetPreload(String). | 
DRAGGABLE_AUTO, DRAGGABLE_FALSE, DRAGGABLE_TRUEDOCUMENT_NODE, ELEMENT_NODE, TEXT_NODE| Modifier | Constructor and Description | 
|---|---|
| protected  | MediaElement() | 
| Modifier and Type | Method and Description | 
|---|---|
| java.lang.String | canPlayType(java.lang.String type)Returns  trueif the native player is capable of playing content of
 the given MIME type. | 
| TimeRanges | getBuffered()Returns a  TimeRangesobject indicating which portions of the
 source have been buffered locally. | 
| java.lang.String | getCurrentSrc()Returns the URL of the current media source, or the empty String
 if no source is set. | 
| double | getCurrentTime()Returns the current time within the source media stream. | 
| double | getDefaultPlaybackRate()Returns the default playback rate, where 1.0 corresponds to normal
 playback. | 
| double | getDuration()Returns the duration of the source media stream, in seconds. | 
| MediaError | getError()Returns the type of error that has occurred while attempting to load
 and play the media. | 
| double | getInitialTime()Returns the time to which the media stream was seeked at the time it was
 loaded, in seconds, or 0.0 if the position is unknown. | 
| int | getNetworkState()Returns the network state, one of  NETWORK_EMPTY,NETWORK_IDLE,NETWORK_LOADING, orNETWORK_NO_SOURCE. | 
| double | getPlaybackRate()Returns the playback rate, where 1.0 corresponds to normal
 playback. | 
| TimeRanges | getPlayed()Returns a  TimeRangesobject indicating which portions of the
 source have been played. | 
| java.lang.String | getPreload() | 
| int | getReadyState()Returns the current state of the media with respect to rendering the
 current playback position, as one of the constants
  HAVE_CURRENT_DATA,HAVE_ENOUGH_DATA,HAVE_FUTURE_DATA,HAVE_METADATA, orHAVE_NOTHING. | 
| TimeRanges | getSeekable()Returns a  TimeRangesobject indicating which portions of the
 source are seekable. | 
| java.lang.String | getSrc()Returns the source URL for the media, or  nullif none is set. | 
| double | getStartOffsetTime()Returns the time corresponding to the zero time in the media timeline,
 measured in seconds since midnight, January 1 1970 UTC, or
  Double.NaNif none is specified. | 
| double | getVolume()Returns the current audio volume setting for the media, as a number
 between 0.0 and 1.0. | 
| boolean | hasControls()Returns  trueif the media player should display interactive
 controls (for example, to control play/pause, seek position, and volume),falseotherwise. | 
| boolean | hasEnded()Returns  trueif playback has reached the end of the media,falseotherwise. | 
| boolean | isAutoplay()Returns  trueif autoplay is enabled,falseotherwise. | 
| boolean | isLoop()Returns  trueif the user agent is to seek back to the start of the
 media once playing has ended,falseotherwise. | 
| boolean | isMuted()Returns  trueif the volume is to be muted (overriding the normal
 volume setting),falseotherwise. | 
| boolean | isPaused()Returns  trueif playback is paused,falseotherwise. | 
| boolean | isSeeking()Returns  trueif the playback position is in the process of changing
 discontinuously, e.g., by use of the interactive controls,falseotherwise. | 
| void | load()Causes the resource to be loaded. | 
| void | pause()Causes playback of the resource to be paused. | 
| void | play()Causes playback of the resource to be started or resumed. | 
| void | setAutoplay(boolean autoplay)Enables or disables autoplay of the resource. | 
| void | setControls(boolean controls)Enables or disables interactive controls. | 
| void | setCurrentTime(double time)Sets the current playback time within the media stream, in seconds. | 
| void | setDefaultPlaybackRate(double rate)Sets the default playback rate. | 
| void | setLoop(boolean loop)Enables or disables looping. | 
| void | setMuted(boolean muted)Enables or disables muting. | 
| void | setPlaybackRate(double rate)Sets the playback rate. | 
| void | setPreload(java.lang.String preload) | 
| void | setSrc(java.lang.String url)Sets the source URL for the media. | 
| void | setVolume(double volume)Sets the playback volume. | 
addClassName, as, as, blur, dispatchEvent, focus, getAbsoluteBottom, getAbsoluteLeft, getAbsoluteRight, getAbsoluteTop, getAttribute, getClassName, getClientHeight, getClientWidth, getDir, getDraggable, getElementsByTagName, getFirstChildElement, getId, getInnerHTML, getInnerText, getLang, getNextSiblingElement, getOffsetHeight, getOffsetLeft, getOffsetParent, getOffsetTop, getOffsetWidth, getPreviousSiblingElement, getPropertyBoolean, getPropertyDouble, getPropertyInt, getPropertyJSO, getPropertyObject, getPropertyString, getScrollHeight, getScrollLeft, getScrollTop, getScrollWidth, getString, getStyle, getTabIndex, getTagName, getTitle, hasAttribute, hasClassName, hasTagName, indexOfName, is, is, removeAttribute, removeClassName, replaceClassName, scrollIntoView, setAttribute, setClassName, setDir, setDraggable, setId, setInnerHTML, setInnerSafeHtml, setInnerText, setLang, setPropertyBoolean, setPropertyDouble, setPropertyInt, setPropertyJSO, setPropertyObject, setPropertyString, setScrollLeft, setScrollTop, setTabIndex, setTitle, toggleClassNameappendChild, cloneNode, getChild, getChildCount, getChildNodes, getFirstChild, getLastChild, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentElement, getParentNode, getPreviousSibling, hasChildNodes, hasParentElement, insertAfter, insertBefore, insertFirst, isOrHasChild, removeAllChildren, removeChild, removeFromParent, replaceChild, setNodeValuecast, createArray, createArray, createFunction, createObject, equals, hashCode, toSource, toStringpublic static final java.lang.String CAN_PLAY_PROBABLY
canPlayType(String).public static final java.lang.String CAN_PLAY_MAYBE
canPlayType(String).public static final java.lang.String CANNOT_PLAY
canPlayType(String).public static final int HAVE_NOTHING
getReadyState().public static final int HAVE_METADATA
getReadyState().public static final int HAVE_CURRENT_DATA
getReadyState().public static final int HAVE_FUTURE_DATA
getReadyState().public static final int HAVE_ENOUGH_DATA
getReadyState().public static final int NETWORK_EMPTY
getNetworkState().public static final int NETWORK_IDLE
getNetworkState().public static final int NETWORK_LOADING
getNetworkState().public static final int NETWORK_NO_SOURCE
getNetworkState().public static final java.lang.String PRELOAD_AUTO
getPreload() and setPreload(String).public static final java.lang.String PRELOAD_METADATA
getPreload() and setPreload(String).public static final java.lang.String PRELOAD_NONE
getPreload() and setPreload(String).public final java.lang.String canPlayType(java.lang.String type)
true if the native player is capable of playing content of
 the given MIME type.type - a String representing a MIME typeCAN_PLAY_PROBABLY, CAN_PLAY_MAYBE, or
         CANNOT_PLAYpublic final TimeRanges getBuffered()
TimeRanges object indicating which portions of the
 source have been buffered locally.TimeRanges instance, or null.public final java.lang.String getCurrentSrc()
public final double getCurrentTime()
setCurrentTime(double)public final double getDefaultPlaybackRate()
setDefaultPlaybackRate(double)public final double getDuration()
Double.NaN is returned.  For unbounded media
 streams, Double.POSITIVE_INFINITY is returned.public final MediaError getError()
null is returned.MediaError instance, or nullpublic final double getInitialTime()
public final int getNetworkState()
NETWORK_EMPTY,
 NETWORK_IDLE, NETWORK_LOADING, or
 NETWORK_NO_SOURCE.NETWORK_EMPTY, 
NETWORK_IDLE, 
NETWORK_LOADING, 
NETWORK_NO_SOURCEpublic final double getPlaybackRate()
setPlaybackRate(double)public final TimeRanges getPlayed()
TimeRanges object indicating which portions of the
 source have been played.TimeRanges instance, or null.public final java.lang.String getPreload()
setPreload(String), 
PRELOAD_AUTO, 
PRELOAD_METADATA, 
PRELOAD_NONEpublic final int getReadyState()
HAVE_CURRENT_DATA, HAVE_ENOUGH_DATA,
 HAVE_FUTURE_DATA, HAVE_METADATA, or HAVE_NOTHING
 .HAVE_CURRENT_DATA, 
HAVE_ENOUGH_DATA, 
HAVE_FUTURE_DATA, 
HAVE_METADATA, 
HAVE_NOTHINGpublic final TimeRanges getSeekable()
TimeRanges object indicating which portions of the
 source are seekable.TimeRanges instance, or null.public final java.lang.String getSrc()
null if none is set.nullsetSrc(String)public final double getStartOffsetTime()
Double.NaN if none is specified.public final double getVolume()
setVolume(double)public final boolean hasControls()
true if the media player should display interactive
 controls (for example, to control play/pause, seek position, and volume),
 false otherwise.setControls(boolean)public final boolean hasEnded()
true if playback has reached the end of the media, false otherwise.public final boolean isAutoplay()
true if autoplay is enabled, false otherwise. When
 autoplay is enabled, the user agent will begin playback automatically as
 soon as it can do so without stopping.setAutoplay(boolean)public final boolean isLoop()
true if the user agent is to seek back to the start of the
 media once playing has ended, false otherwise.setLoop(boolean)public final boolean isMuted()
true if the volume is to be muted (overriding the normal
 volume setting), false otherwise.setMuted(boolean), 
getVolume(), 
setVolume(double)public final boolean isPaused()
true if playback is paused, false otherwise.public final boolean isSeeking()
true if the playback position is in the process of changing
 discontinuously, e.g., by use of the interactive controls, false
 otherwise.setControls(boolean), 
hasControls()public final void load()
public final void pause()
public final void play()
public final void setAutoplay(boolean autoplay)
autoplay - if true, enable autoplayisAutoplay()public final void setControls(boolean controls)
controls - if true, enable controlshasControls()public final void setCurrentTime(double time)
time - a number within the ranges given by getSeekable()getCurrentTime()public final void setDefaultPlaybackRate(double rate)
rate - a double valuegetDefaultPlaybackRate()public final void setLoop(boolean loop)
loop - if true, enable loopingisLoop()public final void setMuted(boolean muted)
muted - if true, enable mutingisMuted()public final void setPlaybackRate(double rate)
rate - a double valuegetPlaybackRate()public final void setPreload(java.lang.String preload)
preload - a String constantsgetPreload(), 
setPreload(String), 
PRELOAD_AUTO, 
PRELOAD_METADATA, 
PRELOAD_NONEpublic final void setSrc(java.lang.String url)
url - a String URLgetSrc()public final void setVolume(double volume)
volume - a value between 0.0 (silent) and 1.0 (loudest)getVolume()