blob: 77ddd0e7ed833a6210803d276c8bce5416d23fdc [file] [log] [blame]
antti76787a82007-10-31 01:03:35 +00001/*
darin@apple.comd9786f42010-06-18 16:47:54 +00002 * Copyright (C) 2007, 2010 Apple Inc. All rights reserved.
antti76787a82007-10-31 01:03:35 +00003 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26module html {
commit-queue@webkit.org2b74ad92011-06-17 18:19:32 +000027 interface [
28 Conditional=VIDEO,
crogers@google.comae81a112011-08-15 19:37:22 +000029 GenerateNativeConverter
commit-queue@webkit.org2b74ad92011-06-17 18:19:32 +000030 ] HTMLMediaElement : HTMLElement {
antti76787a82007-10-31 01:03:35 +000031
32 // error state
33 readonly attribute MediaError error;
34
35 // network state
darin@apple.com17c2d2c2010-08-29 05:48:44 +000036 attribute [Reflect, URL] DOMString src;
abarth@webkit.org24b62492011-05-27 19:53:45 +000037 readonly attribute [URL] DOMString currentSrc;
antti76787a82007-10-31 01:03:35 +000038
eric.carlson@apple.com72a6d932009-03-23 15:02:34 +000039 const unsigned short NETWORK_EMPTY = 0;
40 const unsigned short NETWORK_IDLE = 1;
41 const unsigned short NETWORK_LOADING = 2;
eric.carlson@apple.com65b858a2010-07-19 20:11:56 +000042 const unsigned short NETWORK_NO_SOURCE = 3;
antti76787a82007-10-31 01:03:35 +000043 readonly attribute unsigned short networkState;
eric.carlson@apple.com9f8dbf42010-03-03 17:19:02 +000044 attribute DOMString preload;
eric.carlson@apple.comefd612f2009-03-05 22:56:52 +000045
antti76787a82007-10-31 01:03:35 +000046 readonly attribute TimeRanges buffered;
commit-queue@webkit.org62c8e332011-06-16 18:01:30 +000047 void load()
antti76787a82007-10-31 01:03:35 +000048 raises (DOMException);
abarth@webkit.orgf09f1cc2011-08-05 07:30:29 +000049 DOMString canPlayType(in [Optional=CallWithDefaultValue] DOMString type);
eric.carlson@apple.comc5029842009-03-04 22:21:16 +000050
antti76787a82007-10-31 01:03:35 +000051 // ready state
eric.carlson@apple.com72a6d932009-03-23 15:02:34 +000052 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;
antti76787a82007-10-31 01:03:35 +000057 readonly attribute unsigned short readyState;
58 readonly attribute boolean seeking;
59
60 // playback state
61 attribute float currentTime
62 setter raises (DOMException);
eric.carlson@apple.come6be9342009-05-14 17:51:28 +000063 readonly attribute float startTime;
antti76787a82007-10-31 01:03:35 +000064 readonly attribute float duration;
65 readonly attribute boolean paused;
eric.carlson@apple.com72a6d932009-03-23 15:02:34 +000066 attribute float defaultPlaybackRate;
67 attribute float playbackRate;
antti76787a82007-10-31 01:03:35 +000068 readonly attribute TimeRanges played;
69 readonly attribute TimeRanges seekable;
70 readonly attribute boolean ended;
darin@apple.comd9786f42010-06-18 16:47:54 +000071 attribute [Reflect] boolean autoplay;
72 attribute [Reflect] boolean loop;
commit-queue@webkit.org62c8e332011-06-16 18:01:30 +000073 void play();
74 void pause();
antti76787a82007-10-31 01:03:35 +000075
antti76787a82007-10-31 01:03:35 +000076 // controls
77 attribute boolean controls;
78 attribute float volume
79 setter raises (DOMException);
80 attribute boolean muted;
beidson@apple.comd9bfdc82009-06-23 19:05:30 +000081
eric.carlson@apple.com8cb301d2009-11-12 20:23:15 +000082 // WebKit extensions
beidson@apple.comd9bfdc82009-06-23 19:05:30 +000083 attribute boolean webkitPreservesPitch;
eric.carlson@apple.com8cb301d2009-11-12 20:23:15 +000084
eric.carlson@apple.com9f2f9c62009-11-19 18:14:01 +000085 readonly attribute boolean webkitHasClosedCaptions;
86 attribute boolean webkitClosedCaptionsVisible;
dbates@webkit.orge793e542011-02-02 19:56:36 +000087
dbates@webkit.orge793e542011-02-02 19:56:36 +000088 // The number of bytes consumed by the media decoder.
paroga@webkit.org186b1d72011-07-22 15:50:35 +000089 readonly attribute [Conditional=MEDIA_STATISTICS] unsigned long webkitAudioDecodedByteCount;
90 readonly attribute [Conditional=MEDIA_STATISTICS] unsigned long webkitVideoDecodedByteCount;
commit-queue@webkit.org7b352312011-08-30 23:15:56 +000091
92#if defined(ENABLE_MEDIA_SOURCE) && ENABLE_MEDIA_SOURCE
93 // URL passed to src attribute to enable the media source logic.
94 readonly attribute [URL] DOMString webkitMediaSourceURL;
95
96 // Appends media to to the source.
97 void webkitSourceAppend(in Uint8Array data) raises (DOMException);
98
99 // Signals the end of stream.
100 const unsigned short EOS_NO_ERROR = 0; // End of stream reached w/o error.
101 const unsigned short EOS_NETWORK_ERR = 1; // A network error triggered end of stream.
102 const unsigned short EOS_DECODE_ERR = 2; // A decode error triggered end of stream.
103 void webkitSourceEndOfStream(in unsigned short status) raises (DOMException);
104
105 // Indicates the current state of the media source.
106 const unsigned short SOURCE_CLOSED = 0;
107 const unsigned short SOURCE_OPEN = 1;
108 const unsigned short SOURCE_ENDED = 2;
109 readonly attribute unsigned short webkitSourceState;
110#endif
antti76787a82007-10-31 01:03:35 +0000111};
112}