MediaElement
extern class js.html.MediaElementextends ElementAvailable in jsHTML media elements (such as <audio>
and <video>
) expose the HTMLMediaElement interface which provides special properties and methods (beyond the regular element object interface they also have available to them by inheritance) for manipulating the layout and presentation of media elements.
Documentation for this class was provided by MDN. var audioDecodedByteCount(default,null) : Int var autoplay : BoolReflects the autoplay HTML attribute, indicating whether to begin playing as soon as enough media is available. var buffered(default,null) : TimeRangesThe ranges of the media source that the browser has buffered, if any. var closedCaptionsVisible : Bool var controller : MediaController var controls : BoolReflects the controls HTML attribute, indicating whether user interface items for controlling the resource should be displayed. var currentSrc(default,null) : StringThe absolute URL of the chosen media resource (if, for example, the server selects a media file based on the resolution of the user's display), or an empty string if the networkState is EMPTY. var currentTime : FloatThe current playback time, in seconds. Setting this value seeks the media to the new time. Setter throws DOMException. var defaultMuted : BoolReflects the muted HTML attribute, indicating whether the media element's audio output should be muted by default. Changing the value dynamically will not unmute the audio (it only controls the default state). var defaultPlaybackRate : FloatThe default playback rate for the media. The Ogg backend does not support this. 1.0 is "normal speed," values lower than 1.0 make the media play slower than normal, higher values make it play faster. The value 0.0 is invalid and throws a NOT_SUPPORTED_ERR exception. var duration(default,null) : FloatThe length of the media in seconds, or zero if no media data is available. If the media data is available but the length is unknown, this value is NaN. If the media is streamed and has no predefined length, the value is Inf. var ended(default,null) : BoolIndicates whether the media element has ended playback. var error(default,null) : MediaErrorThe media error object for the most recent error, or null if there has not been an error. var hasClosedCaptions(default,null) : Bool var initialTime(default,null) : Float var loop : BoolReflects the loop HTML attribute, indicating whether the media element should start over when it reaches the end. var mediaGroup : String var muted : Booltrue if the audio is muted, and false otherwise. var networkState(default,null) : Int
var onkeyadded : EventListener
var onkeyerror : EventListener
var onkeymessage : EventListener
var onneedkey : EventListener
var paused(default,null) : BoolIndicates whether the media element is paused.
var playbackRate : FloatThe current rate at which the media is being played back. This is used to implement user controls for fast forward, slow motion, and so forth. The normal playback rate is multiplied by this value to obtain the current rate, so a value of 1.0 indicates normal speed. Not supported by the Ogg backend.
var played(default,null) : TimeRangesThe ranges of the media source that the browser has played, if any.
var preload : StringReflects the
preload
HTML attribute, indicating what data should be preloaded at page-load time, if any.
var preservesPitch : Bool
var readyState(default,null) : Int
var seekable(default,null) : TimeRangesThe time ranges that the user is able to seek to, if any.
var seeking(default,null) : BoolIndicates whether the media is in the process of seeking to a new position.
var src : StringReflects the
src
HTML attribute, containing the URL of a media resource to use.
var startTime(default,null) : FloatThe earliest possible position in the media, in seconds.
var textTracks(default,null) : TextTrackList
var videoDecodedByteCount(default,null) : Int
var volume : FloatThe audio volume, from 0.0 (silent) to 1.0 (loudest). Setter throws DOMException.
function addKey( keySystem : String, key : Uint8Array, ?initData : Uint8Array, sessionId : String ) : Void
function addTextTrack( kind : String, ?label : String, ?language : String ) : TextTrack
function canPlayType( type : String, ?keySystem : String ) : String
function cancelKeyRequest( keySystem : String, sessionId : String ) : Void
function generateKeyRequest( keySystem : String, ?initData : Uint8Array ) : Void
function load() : Void
function pause() : Void
function play() : Void
static inline var HAVE_CURRENT_DATA : IntData is available for the current playback position, but not enough to actually play more than one frame.
static inline var HAVE_ENOUGH_DATA : IntEnough data is available—and the download rate is high enough—that the media can be played through to the end without interruption.
static inline var HAVE_FUTURE_DATA : IntData 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 inline var HAVE_METADATA : IntEnough of the media resource has been retrieved that the metadata attributes are initialized. Seeking will no longer raise an exception.
static inline var HAVE_NOTHING : IntNo information is available about the media resource.
static inline var NETWORK_EMPTY : Int
static inline var NETWORK_IDLE : Int
static inline var NETWORK_LOADING : Int
static inline var NETWORK_NO_SOURCE : Int
Documentation for this class was provided by MDN. var audioDecodedByteCount(default,null) : Int var autoplay : BoolReflects the autoplay HTML attribute, indicating whether to begin playing as soon as enough media is available. var buffered(default,null) : TimeRangesThe ranges of the media source that the browser has buffered, if any. var closedCaptionsVisible : Bool var controller : MediaController var controls : BoolReflects the controls HTML attribute, indicating whether user interface items for controlling the resource should be displayed. var currentSrc(default,null) : StringThe absolute URL of the chosen media resource (if, for example, the server selects a media file based on the resolution of the user's display), or an empty string if the networkState is EMPTY. var currentTime : FloatThe current playback time, in seconds. Setting this value seeks the media to the new time. Setter throws DOMException. var defaultMuted : BoolReflects the muted HTML attribute, indicating whether the media element's audio output should be muted by default. Changing the value dynamically will not unmute the audio (it only controls the default state). var defaultPlaybackRate : FloatThe default playback rate for the media. The Ogg backend does not support this. 1.0 is "normal speed," values lower than 1.0 make the media play slower than normal, higher values make it play faster. The value 0.0 is invalid and throws a NOT_SUPPORTED_ERR exception. var duration(default,null) : FloatThe length of the media in seconds, or zero if no media data is available. If the media data is available but the length is unknown, this value is NaN. If the media is streamed and has no predefined length, the value is Inf. var ended(default,null) : BoolIndicates whether the media element has ended playback. var error(default,null) : MediaErrorThe media error object for the most recent error, or null if there has not been an error. var hasClosedCaptions(default,null) : Bool var initialTime(default,null) : Float var loop : BoolReflects the loop HTML attribute, indicating whether the media element should start over when it reaches the end. var mediaGroup : String var muted : Booltrue if the audio is muted, and false otherwise. var networkState(default,null) : Int
The current state of fetching the media over the network.
Constant | Value | Description |
EMPTY | 0 | There is no data yet. The readyState is also HAVE_NOTHING. |
LOADING | 1 | The media is loading. |
LOADED_METADATA | 2 | The media's metadata has been loaded. |
LOADED_FIRST_FRAME | 3 | The media's first frame has been loaded. |
LOADED | 4 | The media has been fully loaded. |
The readiness state of the media:
Constant | Value | Description |
HAVE_NOTHING | 0 | No information is available about the media resource. |
HAVE_METADATA | 1 | Enough of the media resource has been retrieved that the metadata attributes are initialized. Seeking will no longer raise an exception. |
HAVE_CURRENT_DATA | 2 | Data is available for the current playback position, but not enough to actually play more than one frame. |
HAVE_FUTURE_DATA | 3 | 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). |
HAVE_ENOUGH_DATA | 4 | Enough data is available—and the download rate is high enough—that the media can be played through to the end without interruption. |
version #19228, modified 2013-05-08 11:07:45 by api
0 comment