Backed out changesets 73f3ce609c23 and 990a21978a2d (bug 951431) because they were...
[gecko.git] / dom / webidl / HTMLMediaElement.webidl
blobe45a2d979fa41fd8fab0405ec419383388e85f99
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/.
5  *
6  * The origin of this IDL file is
7  * http://www.whatwg.org/specs/web-apps/current-work/#media-elements
8  *
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.
12  */
14 interface HTMLMediaElement : HTMLElement {
16   // error state
17   readonly attribute MediaError? error;
19   // network state
20   [SetterThrows]
21            attribute DOMString src;
22   readonly attribute DOMString currentSrc;
24   [SetterThrows]
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;
31   [SetterThrows]
32            attribute DOMString preload;
33   [NewObject]
34   readonly attribute TimeRanges buffered;
35   void load();
36   DOMString canPlayType(DOMString type);
38   // ready state
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;
47   // playback state
48   [SetterThrows]
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;
54   [SetterThrows]
55            attribute double defaultPlaybackRate;
56   [SetterThrows]
57            attribute double playbackRate;
58   [NewObject]
59   readonly attribute TimeRanges played;
60   [NewObject]
61   readonly attribute TimeRanges seekable;
62   readonly attribute boolean ended;
63   [SetterThrows]
64            attribute boolean autoplay;
65   [SetterThrows]
66            attribute boolean loop;
67   [Throws]
68   void play();
69   [Throws]
70   void pause();
72   // TODO: Bug 847377 - mediaGroup and MediaController
73   // media controller
74   //         attribute DOMString mediaGroup;
75   //         attribute MediaController? controller;
77   // controls
78   [SetterThrows]
79            attribute boolean controls;
80   [SetterThrows]
81            attribute double volume;
82            attribute boolean muted;
83   [SetterThrows]
84            attribute boolean defaultMuted;
86   // TODO: Bug 847379
87   // tracks
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
105   [Throws]
106   MediaStream mozCaptureStream();
107   [Throws]
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.
127   [Throws]
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.
137   [SetterThrows]
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