dom/interfaces/html/nsIDOMHTMLMediaElement.idl

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:37b4925aa0e4
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7 #include "nsIDOMHTMLElement.idl"
8 #include "nsIDOMMediaError.idl"
9 #include "nsIDOMTimeRanges.idl"
10
11 interface nsIDOMMediaStream;
12
13 /**
14 * The nsIDOMHTMLMediaElement interface is an interface to be implemented by the HTML
15 * <audio> and <video> elements.
16 *
17 * For more information on this interface, please see
18 * http://www.whatwg.org/specs/web-apps/current-work/#htmlmediaelement
19 *
20 * @status UNDER_DEVELOPMENT
21 */
22
23 // undef the GetCurrentTime macro defined in WinBase.h from the MS Platform SDK
24 %{C++
25 #ifdef GetCurrentTime
26 #undef GetCurrentTime
27 #endif
28 %}
29
30 [scriptable, uuid(1f9393e8-2df0-4072-87b9-c26999b09acc)]
31 interface nsIDOMHTMLMediaElement : nsISupports
32 {
33 // error state
34 readonly attribute nsIDOMMediaError error;
35
36 // network state
37 attribute DOMString src;
38 attribute nsIDOMMediaStream mozSrcObject;
39 readonly attribute DOMString currentSrc;
40 attribute DOMString crossOrigin;
41 const unsigned short NETWORK_EMPTY = 0;
42 const unsigned short NETWORK_IDLE = 1;
43 const unsigned short NETWORK_LOADING = 2;
44 const unsigned short NETWORK_NO_SOURCE = 3;
45 readonly attribute unsigned short networkState;
46 attribute DOMString preload;
47 readonly attribute nsIDOMTimeRanges buffered;
48 void load();
49 DOMString canPlayType(in DOMString type);
50
51 // ready state
52 const unsigned short HAVE_NOTHING = 0;
53 const unsigned short HAVE_METADATA = 1;
54 const unsigned short HAVE_CURRENT_DATA = 2;
55 const unsigned short HAVE_FUTURE_DATA = 3;
56 const unsigned short HAVE_ENOUGH_DATA = 4;
57 readonly attribute unsigned short readyState;
58 readonly attribute boolean seeking;
59
60 // playback state
61 attribute double currentTime;
62 readonly attribute double duration;
63 readonly attribute boolean paused;
64 attribute double defaultPlaybackRate;
65 attribute double playbackRate;
66 attribute boolean mozPreservesPitch;
67 readonly attribute nsIDOMTimeRanges played;
68 readonly attribute nsIDOMTimeRanges seekable;
69 readonly attribute boolean ended;
70 readonly attribute boolean mozAutoplayEnabled;
71 attribute boolean autoplay;
72 attribute boolean loop;
73 void play();
74 void pause();
75
76 // controls
77 attribute boolean controls;
78 attribute double volume;
79 attribute boolean muted;
80 attribute boolean defaultMuted;
81
82 // Mozilla extension: stream capture
83 nsIDOMMediaStream mozCaptureStream();
84 nsIDOMMediaStream mozCaptureStreamUntilEnded();
85 readonly attribute boolean mozAudioCaptured;
86
87 // Mozilla extension: return embedded metadata from the stream as a
88 // JSObject with key:value pairs for each tag. This can be used by
89 // player interfaces to display the song title, artist, etc.
90 [implicit_jscontext]
91 jsval mozGetMetadata();
92
93 // Mozilla extension: provides access to the fragment end time if
94 // the media element has a fragment URI for the currentSrc, otherwise
95 // it is equal to the media duration.
96 readonly attribute double mozFragmentEnd;
97
98 // Mozilla extension: an audio channel type for media elements.
99 // An exception is thrown if the app tries to change the audio channel type
100 // without the permission (manifest file for B2G apps).
101 // The supported values are:
102 // * normal (default value)
103 // Automatically paused if "notification" or higher priority channel
104 // is played
105 // Use case: normal applications
106 // * content
107 // Automatically paused if "notification" or higher priority channel
108 // is played. Also paused if another app starts using "content"
109 // channel. Using this channel never affects applications using
110 // the "normal" channel.
111 // Use case: video/audio players
112 // * notification
113 // Automatically paused if "alarm" or higher priority channel is played.
114 // Use case: New email, incoming SMS
115 // * alarm
116 // Automatically paused if "telephony" or higher priority channel is
117 // played.
118 // User case: Alarm clock, calendar alarms
119 // * telephony
120 // Automatically paused if "ringer" or higher priority
121 // channel is played.
122 // Use case: dialer, voip
123 // * ringer
124 // Automatically paused if "publicnotification" or higher priority
125 // channel is played.
126 // Use case: dialer, voip
127 // * publicnotification
128 // Always plays in speaker, even when headphones are plugged in.
129 // Use case: Camera shutter sound.
130 attribute DOMString mozAudioChannelType;
131
132 // In addition the media element has this new events:
133 // * onmozinterruptbegin - called when the media element is interrupted
134 // because of the audiochannel manager.
135 // * onmozinterruptend - called when the interruption is concluded
136 };

mercurial