dom/webidl/HTMLMediaElement.webidl

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:c46b7ca9fbaa
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 */
13
14 interface HTMLMediaElement : HTMLElement {
15
16 // error state
17 readonly attribute MediaError? error;
18
19 // network state
20 [SetterThrows]
21 attribute DOMString src;
22 readonly attribute DOMString currentSrc;
23
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);
37
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;
46
47 // playback state
48 [SetterThrows]
49 attribute double currentTime;
50 [Throws]
51 void fastSeek(double time);
52 readonly attribute unrestricted double duration;
53 // TODO: Bug 847376 - readonly attribute any startDate;
54 readonly attribute boolean paused;
55 [SetterThrows]
56 attribute double defaultPlaybackRate;
57 [SetterThrows]
58 attribute double playbackRate;
59 [NewObject]
60 readonly attribute TimeRanges played;
61 [NewObject]
62 readonly attribute TimeRanges seekable;
63 readonly attribute boolean ended;
64 [SetterThrows]
65 attribute boolean autoplay;
66 [SetterThrows]
67 attribute boolean loop;
68 [Throws]
69 void play();
70 [Throws]
71 void pause();
72
73 // TODO: Bug 847377 - mediaGroup and MediaController
74 // media controller
75 // attribute DOMString mediaGroup;
76 // attribute MediaController? controller;
77
78 // controls
79 [SetterThrows]
80 attribute boolean controls;
81 [SetterThrows]
82 attribute double volume;
83 attribute boolean muted;
84 [SetterThrows]
85 attribute boolean defaultMuted;
86
87 // TODO: Bug 847379
88 // tracks
89 //readonly attribute AudioTrackList audioTracks;
90 //readonly attribute VideoTrackList videoTracks;
91 [Pref="media.webvtt.enabled"]
92 readonly attribute TextTrackList textTracks;
93 [Pref="media.webvtt.enabled"]
94 TextTrack addTextTrack(TextTrackKind kind,
95 optional DOMString label = "",
96 optional DOMString language = "");
97 };
98
99 // Mozilla extensions:
100 partial interface HTMLMediaElement {
101 attribute MediaStream? mozSrcObject;
102 attribute boolean mozPreservesPitch;
103 readonly attribute boolean mozAutoplayEnabled;
104
105 // NB: for internal use with the video controls:
106 [Func="IsChromeOrXBL"] attribute boolean mozMediaStatisticsShowing;
107 [Func="IsChromeOrXBL"] attribute boolean mozAllowCasting;
108 [Func="IsChromeOrXBL"] attribute boolean mozIsCasting;
109
110 // Mozilla extension: stream capture
111 [Throws]
112 MediaStream mozCaptureStream();
113 [Throws]
114 MediaStream mozCaptureStreamUntilEnded();
115 readonly attribute boolean mozAudioCaptured;
116
117 // Mozilla extension: return embedded metadata from the stream as a
118 // JSObject with key:value pairs for each tag. This can be used by
119 // player interfaces to display the song title, artist, etc.
120 [Throws]
121 object? mozGetMetadata();
122
123 // Mozilla extension: provides access to the fragment end time if
124 // the media element has a fragment URI for the currentSrc, otherwise
125 // it is equal to the media duration.
126 readonly attribute double mozFragmentEnd;
127
128 // Mozilla extension: an audio channel type for media elements.
129 // Read AudioChannel.webidl for more information about this attribute.
130 [SetterThrows]
131 attribute AudioChannel mozAudioChannelType;
132
133 // In addition the media element has this new events:
134 // * onmozinterruptbegin - called when the media element is interrupted
135 // because of the audiochannel manager.
136 // * onmozinterruptend - called when the interruption is concluded
137 };

mercurial