Class HTMLMediaElement
java.lang.Object
org.htmlunit.corejs.javascript.ScriptableObject
org.htmlunit.javascript.HtmlUnitScriptable
org.htmlunit.javascript.host.event.EventTarget
org.htmlunit.javascript.host.dom.Node
org.htmlunit.javascript.host.Element
org.htmlunit.javascript.host.html.HTMLElement
org.htmlunit.javascript.host.html.HTMLMediaElement
- All Implemented Interfaces:
Serializable
,Cloneable
,org.htmlunit.corejs.javascript.ConstProperties
,org.htmlunit.corejs.javascript.debug.DebuggableObject
,org.htmlunit.corejs.javascript.Scriptable
,org.htmlunit.corejs.javascript.SymbolScriptable
- Direct Known Subclasses:
HTMLAudioElement
,HTMLVideoElement
The JavaScript object
HTMLMediaElement
.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.htmlunit.javascript.host.html.HTMLElement
HTMLElement.ProxyDomNode
Nested classes/interfaces inherited from class org.htmlunit.corejs.javascript.ScriptableObject
org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Data is available for the current playback position, but not enough to actually play more than one frame.static final int
Enough data is available—and the download rate is high enough—that the media can be played through to the end without interruption.static final int
Data for the current playback position as well as for at least a little bit of time into the future is available (in other words, at least two frames of video, for example).static final int
Enough of the media resource has been retrieved that the metadata attributes are initialized.static final int
No information is available about the media resource.static final int
There is no data yet.static final int
Network is idle.static final int
The media is loading.static final int
There is no source.Fields inherited from class org.htmlunit.javascript.host.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
Fields inherited from class org.htmlunit.corejs.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
Fields inherited from interface org.htmlunit.corejs.javascript.Scriptable
NOT_FOUND
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncanPlayType
(String type) Determines whether the specified media type can be played back.Returns the absolute URL of the chosen media resource.Gets the JavaScript propertynodeName
for the current node.protected String
int
Gets the JavaScript propertynodeType
for the current node.getSrc()
Returns the URL of the audio to embed.void
JavaScript constructor.void
load()
Resets the media element to its initial state and begins the process of selecting a media source and loading the media in preparation for playback to begin at the beginning.void
pause()
Pauses playback of the media.play()
Begins playback of the media.void
Sets the value of thesrc
attribute.Methods inherited from class org.htmlunit.javascript.host.html.HTMLElement
blur, click, focus, getAccessKey, getAlign, getAttributeNode, getAutofocus, getBoundingClientRect, getCh, getChOff, getContentEditable, getDataset, getDir, getDomNodeOrDie, getDomNodeOrNull, getEnterKeyHint, getForm, getInnerText, getLang, getLocalName, getName, getOffsetHeight, getOffsetLeft, getOffsetParent_js, getOffsetTop, getOffsetWidth, getOnabort, getOnanimationcancel, getOnanimationend, getOnanimationiteration, getOnanimationstart, getOnauxclick, getOnblur, getOncancel, getOncanplay, getOncanplaythrough, getOnchange, getOnclick, getOnclose, getOncontextmenu, getOncopy, getOncuechange, getOncut, getOndblclick, getOndrag, getOndragend, getOndragenter, getOndragleave, getOndragover, getOndragstart, getOndrop, getOndurationchange, getOnemptied, getOnended, getOnerror, getOnfocus, getOngotpointercapture, getOninput, getOninvalid, getOnkeydown, getOnkeypress, getOnkeyup, getOnload, getOnloadeddata, getOnloadedmetadata, getOnloadstart, getOnlostpointercapture, getOnmousedown, getOnmouseenter, getOnmouseleave, getOnmousemove, getOnmouseout, getOnmouseover, getOnmouseup, getOnmousewheel, getOnmozfullscreenchange, getOnmozfullscreenerror, getOnpaste, getOnpause, getOnplay, getOnplaying, getOnpointercancel, getOnpointerdown, getOnpointerenter, getOnpointerleave, getOnpointermove, getOnpointerout, getOnpointerover, getOnpointerup, getOnprogress, getOnratechange, getOnreset, getOnresize, getOnscroll, getOnscrollend, getOnseeked, getOnseeking, getOnselect, getOnselectionchange, getOnselectstart, getOnstalled, getOnsubmit, getOnsuspend, getOntimeupdate, getOntoggle, getOntransitioncancel, getOntransitionend, getOntransitionrun, getOntransitionstart, getOnvolumechange, getOnwaiting, getOnwheel, getOuterText, getParentHTMLElement, getPosX, getPosY, getPrefix, getStyle, getTabIndex, getTitle, getVAlign, getValue, getWidthOrHeight, isAncestorOfEventTarget, isDisabled, isEndTagForbidden, isHidden, isIsContentEditable, isLowerCaseInOuterHtml, isSpellcheck, setAccessKey, setAlign, setAttribute, setAutofocus, setCh, setChOff, setColorAttribute, setContentEditable, setDir, setDisabled, setDomNode, setEnterKeyHint, setHidden, setInnerText, setLang, setName, setOnabort, setOnanimationcancel, setOnanimationend, setOnanimationiteration, setOnanimationstart, setOnauxclick, setOnblur, setOncancel, setOncanplay, setOncanplaythrough, setOnchange, setOnclick, setOnclose, setOncontextmenu, setOncopy, setOncuechange, setOncut, setOndblclick, setOndrag, setOndragend, setOndragenter, setOndragleave, setOndragover, setOndragstart, setOndrop, setOndurationchange, setOnemptied, setOnended, setOnerror, setOnfocus, setOngotpointercapture, setOninput, setOninvalid, setOnkeydown, setOnkeypress, setOnkeyup, setOnload, setOnloadeddata, setOnloadedmetadata, setOnloadstart, setOnlostpointercapture, setOnmousedown, setOnmouseenter, setOnmouseleave, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnmousewheel, setOnmozfullscreenchange, setOnmozfullscreenerror, setOnpaste, setOnpause, setOnplay, setOnplaying, setOnpointercancel, setOnpointerdown, setOnpointerenter, setOnpointerleave, setOnpointermove, setOnpointerout, setOnpointerover, setOnpointerup, setOnprogress, setOnratechange, setOnreset, setOnresize, setOnscroll, setOnscrollend, setOnseeked, setOnseeking, setOnselect, setOnselectionchange, setOnselectstart, setOnstalled, setOnsubmit, setOnsuspend, setOntimeupdate, setOntoggle, setOntransitioncancel, setOntransitionend, setOntransitionrun, setOntransitionstart, setOnvolumechange, setOnwaiting, setOnwheel, setOuterText, setSpellcheck, setStyle, setTabIndex, setTextContent, setTitle, setVAlign, setValue, setWidthOrHeight, toString
Methods inherited from class org.htmlunit.javascript.host.Element
after, append, before, closest, createAttributesObject, createEventHandler, getAttribute, getAttributeNodeNS, getAttributeNS, getAttributes, getChildElementCount, getChildren, getClassList, getClassName_js, getClientHeight, getClientLeft, getClientRects, getClientTop, getClientWidth, getElementsByClassName, getElementsByTagName, getElementsByTagNameNS, getFirstElementChild, getId, getInnerHTML, getInnerHTML, getLastElementChild, getNamespaceURI, getNextElementSibling, getOnbeforecopy, getOnbeforecut, getOnbeforepaste, getOnsearch, getOnwebkitfullscreenchange, getOnwebkitfullscreenerror, getOuterHTML, getParentElement, getPreviousElementSibling, getScrollHeight, getScrollLeft, getScrollTop, getScrollWidth, getTagName, hasAttribute, hasAttributeNS, hasAttributes, innerHTML, insertAdjacentElement, insertAdjacentHTML, insertAdjacentText, isDisplayNone, matches, mozMatchesSelector, prepend, printChildren, printNode, querySelector, querySelectorAll, releaseCapture, remove, removeAttribute, removeAttributeNode, removeAttributeNS, replaceChildren, replaceWith, scroll, scrollBy, scrollIntoView, scrollIntoViewIfNeeded, scrollTo, setAttributeNode, setAttributeNS, setCapture, setClassName_js, setId, setInnerHTML, setOnbeforecopy, setOnbeforecut, setOnbeforepaste, setOnsearch, setOnwebkitfullscreenchange, setOnwebkitfullscreenerror, setOuterHTML, setScrollLeft, setScrollTop, toggleAttribute, webkitMatchesSelector
Methods inherited from class org.htmlunit.javascript.host.dom.Node
after, append, appendChild, before, cloneNode, compareDocumentPosition, contains, getBaseURI, getChildNodes, getFirstChild, getJavaScriptNode, getLastChild, getNextSibling, getNodeValue, getOwnerDocument, getParent, getParentNode, getPreviousSibling, getRootNode, getTextContent, hasChildNodes, insertBefore, insertBeforeImpl, isEqualNode, isSameNode, normalize, prepend, removeChild, replaceChild, replaceChildren, replaceWith, setNodeValue
Methods inherited from class org.htmlunit.javascript.host.event.EventTarget
addEventListener, clearEventListenersContainer, dispatchEvent, executeEventLocally, fireEvent, getEventHandler, getEventListenersContainer, hasEventHandlers, isEventHandlerOnWindow, removeEventListener, setEventHandler
Methods inherited from class org.htmlunit.javascript.HtmlUnitScriptable
clone, equivalentValues, get, getBrowserVersion, getClassName, getDefaultValue, getPrototype, getScriptableFor, getStartingScope, getWindow, getWindow, getWithPreemption, has, hasInstance, initParentScope, makeScriptableFor, put, setClassName, setDomNode, setParentScope, setupPromise, setupRejectedPromise
Methods inherited from class org.htmlunit.corejs.javascript.ScriptableObject
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, get, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setPrototype, size
-
Field Details
-
HAVE_NOTHING
public static final int HAVE_NOTHINGNo information is available about the media resource.- See Also:
-
HAVE_METADATA
public static final int HAVE_METADATAEnough of the media resource has been retrieved that the metadata attributes are initialized. Seeking will no longer raise an exception.- See Also:
-
HAVE_CURRENT_DATA
public static final int HAVE_CURRENT_DATAData is available for the current playback position, but not enough to actually play more than one frame.- See Also:
-
HAVE_FUTURE_DATA
public static final int HAVE_FUTURE_DATAData for the current playback position as well as for at least a little bit of time into the future is available (in other words, at least two frames of video, for example).- See Also:
-
HAVE_ENOUGH_DATA
public static final int HAVE_ENOUGH_DATAEnough data is available—and the download rate is high enough—that the media can be played through to the end without interruption.- See Also:
-
NETWORK_EMPTY
public static final int NETWORK_EMPTYThere is no data yet.- See Also:
-
NETWORK_IDLE
public static final int NETWORK_IDLENetwork is idle.- See Also:
-
NETWORK_LOADING
public static final int NETWORK_LOADINGThe media is loading.- See Also:
-
NETWORK_NO_SOURCE
public static final int NETWORK_NO_SOURCEThere is no source.- See Also:
-
-
Constructor Details
-
HTMLMediaElement
public HTMLMediaElement()Creates an instance.
-
-
Method Details
-
jsConstructor
public void jsConstructor()JavaScript constructor.- Overrides:
jsConstructor
in classHTMLElement
-
canPlayType
Determines whether the specified media type can be played back.- Parameters:
type
- the type- Returns:
- "probably", "maybe", or ""
-
play
Begins playback of the media.- Returns:
- a Promise which is fulfilled when playback has been started, or is rejected if for any reason playback cannot be started
-
pause
public void pause()Pauses playback of the media. -
load
public void load()Resets the media element to its initial state and begins the process of selecting a media source and loading the media in preparation for playback to begin at the beginning. -
getNodeType
public int getNodeType()Gets the JavaScript propertynodeType
for the current node.- Overrides:
getNodeType
in classNode
- Returns:
- the node type
-
getNodeName
Gets the JavaScript propertynodeName
for the current node.- Overrides:
getNodeName
in classHTMLElement
- Returns:
- the node name
-
getNodeNameCustomize
-
getSrc
Returns the URL of the audio to embed.- Returns:
- the value of the
src
attribute
-
setSrc
Sets the value of thesrc
attribute.- Parameters:
src
- the value of thesrc
attribute
-
getCurrentSrc
Returns the absolute URL of the chosen media resource. This could happen, for example, if the web server selects a media file based on the resolution of the user's display. The value is an empty string if the networkState property is EMPTY.- Returns:
- the absolute URL of the chosen media resource
-