Class 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

public class HTMLMediaElement extends HTMLElement
The JavaScript object HTMLMediaElement.
See Also:
  • Field Details

    • HAVE_NOTHING

      public static final int HAVE_NOTHING
      No information is available about the media resource.
      See Also:
    • HAVE_METADATA

      public static final int HAVE_METADATA
      Enough 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_DATA
      Data 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_DATA
      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).
      See Also:
    • HAVE_ENOUGH_DATA

      public static final int HAVE_ENOUGH_DATA
      Enough 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_EMPTY
      There is no data yet.
      See Also:
    • NETWORK_IDLE

      public static final int NETWORK_IDLE
      Network is idle.
      See Also:
    • NETWORK_LOADING

      public static final int NETWORK_LOADING
      The media is loading.
      See Also:
    • NETWORK_NO_SOURCE

      public static final int NETWORK_NO_SOURCE
      There is no source.
      See Also:
  • Constructor Details

    • HTMLMediaElement

      public HTMLMediaElement()
      Creates an instance.
  • Method Details

    • jsConstructor

      public void jsConstructor()
      JavaScript constructor.
      Overrides:
      jsConstructor in class HTMLElement
    • canPlayType

      public String canPlayType(String type)
      Determines whether the specified media type can be played back.
      Parameters:
      type - the type
      Returns:
      "probably", "maybe", or ""
    • play

      public Object 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 property nodeType for the current node.
      Overrides:
      getNodeType in class Node
      Returns:
      the node type
    • getNodeName

      public String getNodeName()
      Gets the JavaScript property nodeName for the current node.
      Overrides:
      getNodeName in class HTMLElement
      Returns:
      the node name
    • getNodeNameCustomize

      protected String getNodeNameCustomize()
    • getSrc

      public String getSrc()
      Returns the URL of the audio to embed.
      Returns:
      the value of the src attribute
    • setSrc

      public void setSrc(String src)
      Sets the value of the src attribute.
      Parameters:
      src - the value of the src attribute
    • getCurrentSrc

      public String 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