1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/.
6 * The origin of this IDL file is
7 * http://www.whatwg.org/specs/web-apps/current-work/#media-elements
9 * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
10 * Opera Software ASA. You are granted a license to use, reproduce
11 * and create derivative works of this document.
14 interface HTMLMediaElement : HTMLElement {
17 readonly attribute MediaError? error;
21 attribute DOMString src;
22 readonly attribute DOMString currentSrc;
25 attribute DOMString crossOrigin;
26 const unsigned short NETWORK_EMPTY = 0;
27 const unsigned short NETWORK_IDLE = 1;
28 const unsigned short NETWORK_LOADING = 2;
29 const unsigned short NETWORK_NO_SOURCE = 3;
30 readonly attribute unsigned short networkState;
32 attribute DOMString preload;
34 readonly attribute TimeRanges buffered;
36 DOMString canPlayType(DOMString type);
39 const unsigned short HAVE_NOTHING = 0;
40 const unsigned short HAVE_METADATA = 1;
41 const unsigned short HAVE_CURRENT_DATA = 2;
42 const unsigned short HAVE_FUTURE_DATA = 3;
43 const unsigned short HAVE_ENOUGH_DATA = 4;
44 readonly attribute unsigned short readyState;
45 readonly attribute boolean seeking;
49 attribute double currentTime;
50 // TODO: Bug 847375 - void fastSeek(double time);
51 readonly attribute unrestricted double duration;
52 // TODO: Bug 847376 - readonly attribute any startDate;
53 readonly attribute boolean paused;
55 attribute double defaultPlaybackRate;
57 attribute double playbackRate;
59 readonly attribute TimeRanges played;
61 readonly attribute TimeRanges seekable;
62 readonly attribute boolean ended;
64 attribute boolean autoplay;
66 attribute boolean loop;
72 // TODO: Bug 847377 - mediaGroup and MediaController
74 // attribute DOMString mediaGroup;
75 // attribute MediaController? controller;
79 attribute boolean controls;
81 attribute double volume;
82 attribute boolean muted;
84 attribute boolean defaultMuted;
88 //readonly attribute AudioTrackList audioTracks;
89 //readonly attribute VideoTrackList videoTracks;
90 [Pref="media.webvtt.enabled"]
91 readonly attribute TextTrackList textTracks;
92 [Pref="media.webvtt.enabled"]
93 TextTrack addTextTrack(TextTrackKind kind,
94 optional DOMString label = "",
95 optional DOMString language = "");
98 // Mozilla extensions:
99 partial interface HTMLMediaElement {
100 attribute MediaStream? mozSrcObject;
101 attribute boolean mozPreservesPitch;
102 readonly attribute boolean mozAutoplayEnabled;
104 // Mozilla extension: stream capture
106 MediaStream mozCaptureStream();
108 MediaStream mozCaptureStreamUntilEnded();
109 readonly attribute boolean mozAudioCaptured;
111 // Mozilla extension: extra stream metadata information, used as part
112 // of MozAudioAvailable events and the mozWriteAudio() method. The
113 // mozFrameBufferLength method allows for the size of the framebuffer
114 // used within MozAudioAvailable events to be changed. The new size must
115 // be between 512 and 16384. The default size, for a media element with
116 // audio is (mozChannels * 1024).
117 [Pref="media.audio_data.enabled", GetterThrows]
118 readonly attribute unsigned long mozChannels;
119 [Pref="media.audio_data.enabled", GetterThrows]
120 readonly attribute unsigned long mozSampleRate;
121 [Pref="media.audio_data.enabled", Throws]
122 attribute unsigned long mozFrameBufferLength;
124 // Mozilla extension: return embedded metadata from the stream as a
125 // JSObject with key:value pairs for each tag. This can be used by
126 // player interfaces to display the song title, artist, etc.
128 object? mozGetMetadata();
130 // Mozilla extension: provides access to the fragment end time if
131 // the media element has a fragment URI for the currentSrc, otherwise
132 // it is equal to the media duration.
133 readonly attribute double mozFragmentEnd;
135 // Mozilla extension: an audio channel type for media elements.
136 // Read AudioChannel.webidl for more information about this attribute.
138 attribute AudioChannel mozAudioChannelType;
140 // In addition the media element has this new events:
141 // * onmozinterruptbegin - called when the media element is interrupted
142 // because of the audiochannel manager.
143 // * onmozinterruptend - called when the interruption is concluded