blob: b27a6e9af7327c86fc8fafc8c4ec6d55b0a66db4 [file] [log] [blame]
antti76787a82007-10-31 01:03:35 +00001/*
eric.carlson@apple.comcced8be2011-09-01 18:10:51 +00002 * Copyright (C) 2007, 2010, 2011 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,
haraken@chromium.orgefee39f2012-02-08 06:40:54 +000029 JSGenerateToNativeObject
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);
commit-queue@webkit.orga80672a2012-04-11 22:04:01 +000049#if defined(ENABLE_ENCRYPTED_MEDIA) && ENABLE_ENCRYPTED_MEDIA
50 DOMString canPlayType(in [Optional=DefaultIsUndefined] DOMString type, in [Optional=DefaultIsNullString, TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString keySystem);
51#else
haraken@chromium.org18d2e412012-02-10 00:25:00 +000052 DOMString canPlayType(in [Optional=DefaultIsUndefined] DOMString type);
commit-queue@webkit.orga80672a2012-04-11 22:04:01 +000053#endif
eric.carlson@apple.comc5029842009-03-04 22:21:16 +000054
antti76787a82007-10-31 01:03:35 +000055 // ready state
eric.carlson@apple.com72a6d932009-03-23 15:02:34 +000056 const unsigned short HAVE_NOTHING = 0;
57 const unsigned short HAVE_METADATA = 1;
58 const unsigned short HAVE_CURRENT_DATA = 2;
59 const unsigned short HAVE_FUTURE_DATA = 3;
60 const unsigned short HAVE_ENOUGH_DATA = 4;
antti76787a82007-10-31 01:03:35 +000061 readonly attribute unsigned short readyState;
62 readonly attribute boolean seeking;
63
64 // playback state
65 attribute float currentTime
66 setter raises (DOMException);
eric.carlson@apple.comf381ec92011-09-08 20:19:34 +000067 readonly attribute double initialTime;
eric.carlson@apple.come6be9342009-05-14 17:51:28 +000068 readonly attribute float startTime;
antti76787a82007-10-31 01:03:35 +000069 readonly attribute float duration;
70 readonly attribute boolean paused;
eric.carlson@apple.com72a6d932009-03-23 15:02:34 +000071 attribute float defaultPlaybackRate;
72 attribute float playbackRate;
antti76787a82007-10-31 01:03:35 +000073 readonly attribute TimeRanges played;
74 readonly attribute TimeRanges seekable;
75 readonly attribute boolean ended;
darin@apple.comd9786f42010-06-18 16:47:54 +000076 attribute [Reflect] boolean autoplay;
77 attribute [Reflect] boolean loop;
commit-queue@webkit.org62c8e332011-06-16 18:01:30 +000078 void play();
79 void pause();
antti76787a82007-10-31 01:03:35 +000080
antti76787a82007-10-31 01:03:35 +000081 // controls
82 attribute boolean controls;
83 attribute float volume
84 setter raises (DOMException);
85 attribute boolean muted;
eric.carlson@apple.comcced8be2011-09-01 18:10:51 +000086 attribute [Reflect=muted] boolean defaultMuted;
87
eric.carlson@apple.com8cb301d2009-11-12 20:23:15 +000088 // WebKit extensions
beidson@apple.comd9bfdc82009-06-23 19:05:30 +000089 attribute boolean webkitPreservesPitch;
eric.carlson@apple.com8cb301d2009-11-12 20:23:15 +000090
eric.carlson@apple.com9f2f9c62009-11-19 18:14:01 +000091 readonly attribute boolean webkitHasClosedCaptions;
92 attribute boolean webkitClosedCaptionsVisible;
dbates@webkit.orge793e542011-02-02 19:56:36 +000093
dbates@webkit.orge793e542011-02-02 19:56:36 +000094 // The number of bytes consumed by the media decoder.
paroga@webkit.org186b1d72011-07-22 15:50:35 +000095 readonly attribute [Conditional=MEDIA_STATISTICS] unsigned long webkitAudioDecodedByteCount;
96 readonly attribute [Conditional=MEDIA_STATISTICS] unsigned long webkitVideoDecodedByteCount;
commit-queue@webkit.org7b352312011-08-30 23:15:56 +000097
98#if defined(ENABLE_MEDIA_SOURCE) && ENABLE_MEDIA_SOURCE
99 // URL passed to src attribute to enable the media source logic.
commit-queue@webkit.orgf5c71f12012-04-11 17:32:54 +0000100 readonly attribute [V8EnabledAtRuntime=mediaSource, URL] DOMString webkitMediaSourceURL;
commit-queue@webkit.org7b352312011-08-30 23:15:56 +0000101
102 // Appends media to to the source.
commit-queue@webkit.orgf5c71f12012-04-11 17:32:54 +0000103 [V8EnabledAtRuntime=mediaSource] void webkitSourceAppend(in Uint8Array data) raises (DOMException);
commit-queue@webkit.org7b352312011-08-30 23:15:56 +0000104
105 // Signals the end of stream.
commit-queue@webkit.orgf5c71f12012-04-11 17:32:54 +0000106 [V8EnabledAtRuntime=mediaSource] const unsigned short EOS_NO_ERROR = 0; // End of stream reached w/o error.
107 [V8EnabledAtRuntime=mediaSource] const unsigned short EOS_NETWORK_ERR = 1; // A network error triggered end of stream.
108 [V8EnabledAtRuntime=mediaSource] const unsigned short EOS_DECODE_ERR = 2; // A decode error triggered end of stream.
109 [V8EnabledAtRuntime=mediaSource] void webkitSourceEndOfStream(in unsigned short status) raises (DOMException);
commit-queue@webkit.org7b352312011-08-30 23:15:56 +0000110
111 // Indicates the current state of the media source.
commit-queue@webkit.orgf5c71f12012-04-11 17:32:54 +0000112 [V8EnabledAtRuntime=mediaSource] const unsigned short SOURCE_CLOSED = 0;
113 [V8EnabledAtRuntime=mediaSource] const unsigned short SOURCE_OPEN = 1;
114 [V8EnabledAtRuntime=mediaSource] const unsigned short SOURCE_ENDED = 2;
115 readonly attribute [V8EnabledAtRuntime=mediaSource] unsigned short webkitSourceState;
commit-queue@webkit.org7b352312011-08-30 23:15:56 +0000116#endif
annacc@chromium.orgef5d1dc2011-10-20 02:53:38 +0000117
commit-queue@webkit.orga2a07c02012-04-10 17:47:50 +0000118#if defined(ENABLE_ENCRYPTED_MEDIA) && ENABLE_ENCRYPTED_MEDIA
119 [V8EnabledAtRuntime=encryptedMedia] void webkitGenerateKeyRequest(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString keySystem, in [Optional] Uint8Array initData)
120 raises (DOMException);
121 [V8EnabledAtRuntime=encryptedMedia] void webkitAddKey(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString keySystem, in Uint8Array key, in [Optional] Uint8Array initData, in [Optional=DefaultIsNullString] DOMString sessionId)
122 raises (DOMException);
123 [V8EnabledAtRuntime=encryptedMedia] void webkitCancelKeyRequest(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString keySystem, in [Optional=DefaultIsNullString] DOMString sessionId)
124 raises (DOMException);
125#endif
126
annacc@chromium.orgef5d1dc2011-10-20 02:53:38 +0000127#if defined(ENABLE_VIDEO_TRACK) && ENABLE_VIDEO_TRACK
haraken@chromium.org4cc652f2012-02-03 16:53:10 +0000128 [V8EnabledAtRuntime=webkitVideoTrack] TextTrack addTextTrack(in DOMString kind, in [Optional] DOMString label, in [Optional] DOMString language)
eric.carlson@apple.com892b7112011-11-16 16:05:45 +0000129 raises (DOMException);
haraken@chromium.org4cc652f2012-02-03 16:53:10 +0000130 readonly attribute [V8EnabledAtRuntime=webkitVideoTrack] TextTrackList textTracks;
annacc@chromium.orgef5d1dc2011-10-20 02:53:38 +0000131#endif
jer.noble@apple.combe39c542011-11-14 17:55:16 +0000132
haraken@chromium.orgf80d78c2012-02-21 06:23:57 +0000133 attribute [Reflect, TreatNullAs=NullString] DOMString mediaGroup;
jer.noble@apple.combe39c542011-11-14 17:55:16 +0000134 attribute [CustomSetter] MediaController controller;
antti76787a82007-10-31 01:03:35 +0000135};
136}