--- title: nsIDOMHTMLMediaElement slug: orphaned/NsIDOMHTMLMediaElement original_slug: NsIDOMHTMLMediaElement ---

nsIDOMHTMLMediaElement インターフェースは HTML 5 における audio および video 要素の実装に用いられています。

注意: cue ranges 機能の仕様は現在流動的な状況にあり、 HTML 5 標準においては大幅に改訂が加えられるか、置き換えられてしまう可能性があります。そのため、現時点では Firefox ではこの機能に対応していません。

dom/public/idl/html/nsIDOMHTMLMediaElement.idlScriptable
Please add a summary to this article.
  最終更新: Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0)

Inherits from: nsIDOMHTMLElement

メソッド概要 (Method Overview)

void addCueRange(in DOMString className, in float start, in float end, in boolean pauseOnExit, in nsIDOMHTMLVoidCallback enterCallback, in nsIDOMHTMLVoidCallback exitCallback);
DOMString canPlayType(in DOMString type);
void load();
void pause();
void play();
void removeCueRanges(in DOMString className);

属性 (Attributes)

属性 意味
autoplay boolean true if playback should automatically begin as soon as enough media is available to do so without interruption.
buffered TimeRanges A static, normalized TimeRanges object describing the time ranges of the media that have been buffered.  Read only.  未実装
bufferedBytes ByteRanges A static, normalized ByteRanges object describing the byte ranges of the media that have been buffered.  Read only.  未実装
bufferingRate float The average number of bits per second for the current download over the past few seconds.  If there is no download in progress, this value is 0.0.  Read only.  未実装
bufferingThrottled boolean true if Firefox is intentionally throttling the bandwidth used by the download (such as when the download is paused), otherwise false. Read only.  未実装
controls boolean true if user interface for controlling the media should be presented.
currentSrc DOMString The 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. Read only.
currentTime float The current playback time, in seconds.  Setting this value will seek the media to the new time.
defaultPlaybackRate float The 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.
duration float The 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 InfRead only.
ended boolean true if playback has finished.  Read only.
error nsIDOMHTMLMediaError The media's error status.  Read only.
muted boolean true if the audio is muted, otherwise false.
networkState unsigned short

The current state of the fetch of the media. Read only.

定数 意味
EMPTY 0 There is no data yet.  The readyState will also be 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.
paused boolean true if the media playback is currently paused.  Read only.
playbackRate float The 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.
readyState unsigned short

The media's current readiness state.  Read only.

定数 意味
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_SOME_DATA 2 Data for the current playback position is not available, but there is at least one playback position for which data is available.
HAVE_CURRENT_DATA 3 Data is available for the current playback position, but not enough to actually play more than one frame.
HAVE_FUTURE_DATA 4 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 5 Enough data is available—and the download rate is high enough—that the media can be played through to the end without interruption.
seeking boolean true if the media is in the process of seeking to a new position, otherwise false. Read only.
src DOMString The URL of the media to present.
totalBytes unsigned long The length, in bytes, of the media resource.  If the length is unknown, or the content is streamed and therefore has no specified length, this value is 0.  Read only.
volume float The current audio volume, from 0.0 (silent) to 1.0 (maximum).

メソッド (Methods)

addCueRange()

Note: This method is not yet implemented, as its definition is in flux in the HTML 5 standard.

Adds a cue range to the media element.

void addCueRange(
  in DOMString className,
  in float start,
  in float end,
  in boolean pauseOnExit,
  in nsIDOMHTMLVoidCallback enterCallback,
  in nsIDOMHTMLVoidCallback exitCallback
);
Parameters

xxx

canPlayType()

Determines whether or not the specified media type can be played back.

DOMString canPlayType(
  in DOMString type
);
Parameters
type
The media type to test for, such as "video/ogg".
Return value

Because media formats are complicated, and it's impossible to judge every possible detail from the type string, there is no such thing as 100% certain that the specified type can be played; the best you can do is "probably".

load()

Begins loading the media content from the server.

 void load();
Parameters

None.

pause()

Pauses the media playback.

 void pause();
Parameters

None.

play()

Begins playback of the media.

 void play();
Parameters

None.

removeCueRanges()

Note: This function is not yet implemented, as its definition in the HTML 5 standard is in flux.
void removeCueRanges(
  in DOMString className
);
Parameters

xxx

参考資料