antti | 76787a8 | 2007-10-31 01:03:35 +0000 | [diff] [blame] | 1 | /* |
eric.carlson@apple.com | cced8be | 2011-09-01 18:10:51 +0000 | [diff] [blame] | 2 | * Copyright (C) 2007, 2010, 2011 Apple Inc. All rights reserved. |
antti | 76787a8 | 2007-10-31 01:03:35 +0000 | [diff] [blame] | 3 | * |
| 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 | |
| 26 | module html { |
commit-queue@webkit.org | 2b74ad9 | 2011-06-17 18:19:32 +0000 | [diff] [blame] | 27 | interface [ |
| 28 | Conditional=VIDEO, |
haraken@chromium.org | efee39f | 2012-02-08 06:40:54 +0000 | [diff] [blame] | 29 | JSGenerateToNativeObject |
commit-queue@webkit.org | 2b74ad9 | 2011-06-17 18:19:32 +0000 | [diff] [blame] | 30 | ] HTMLMediaElement : HTMLElement { |
antti | 76787a8 | 2007-10-31 01:03:35 +0000 | [diff] [blame] | 31 | |
| 32 | // error state |
| 33 | readonly attribute MediaError error; |
| 34 | |
| 35 | // network state |
darin@apple.com | 17c2d2c | 2010-08-29 05:48:44 +0000 | [diff] [blame] | 36 | attribute [Reflect, URL] DOMString src; |
abarth@webkit.org | 24b6249 | 2011-05-27 19:53:45 +0000 | [diff] [blame] | 37 | readonly attribute [URL] DOMString currentSrc; |
antti | 76787a8 | 2007-10-31 01:03:35 +0000 | [diff] [blame] | 38 | |
eric.carlson@apple.com | 72a6d93 | 2009-03-23 15:02:34 +0000 | [diff] [blame] | 39 | const unsigned short NETWORK_EMPTY = 0; |
| 40 | const unsigned short NETWORK_IDLE = 1; |
| 41 | const unsigned short NETWORK_LOADING = 2; |
eric.carlson@apple.com | 65b858a | 2010-07-19 20:11:56 +0000 | [diff] [blame] | 42 | const unsigned short NETWORK_NO_SOURCE = 3; |
antti | 76787a8 | 2007-10-31 01:03:35 +0000 | [diff] [blame] | 43 | readonly attribute unsigned short networkState; |
eric.carlson@apple.com | 9f8dbf4 | 2010-03-03 17:19:02 +0000 | [diff] [blame] | 44 | attribute DOMString preload; |
eric.carlson@apple.com | efd612f | 2009-03-05 22:56:52 +0000 | [diff] [blame] | 45 | |
antti | 76787a8 | 2007-10-31 01:03:35 +0000 | [diff] [blame] | 46 | readonly attribute TimeRanges buffered; |
commit-queue@webkit.org | 62c8e33 | 2011-06-16 18:01:30 +0000 | [diff] [blame] | 47 | void load() |
antti | 76787a8 | 2007-10-31 01:03:35 +0000 | [diff] [blame] | 48 | raises (DOMException); |
commit-queue@webkit.org | a80672a | 2012-04-11 22:04:01 +0000 | [diff] [blame^] | 49 | #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.org | 18d2e41 | 2012-02-10 00:25:00 +0000 | [diff] [blame] | 52 | DOMString canPlayType(in [Optional=DefaultIsUndefined] DOMString type); |
commit-queue@webkit.org | a80672a | 2012-04-11 22:04:01 +0000 | [diff] [blame^] | 53 | #endif |
eric.carlson@apple.com | c502984 | 2009-03-04 22:21:16 +0000 | [diff] [blame] | 54 | |
antti | 76787a8 | 2007-10-31 01:03:35 +0000 | [diff] [blame] | 55 | // ready state |
eric.carlson@apple.com | 72a6d93 | 2009-03-23 15:02:34 +0000 | [diff] [blame] | 56 | 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; |
antti | 76787a8 | 2007-10-31 01:03:35 +0000 | [diff] [blame] | 61 | 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.com | f381ec9 | 2011-09-08 20:19:34 +0000 | [diff] [blame] | 67 | readonly attribute double initialTime; |
eric.carlson@apple.com | e6be934 | 2009-05-14 17:51:28 +0000 | [diff] [blame] | 68 | readonly attribute float startTime; |
antti | 76787a8 | 2007-10-31 01:03:35 +0000 | [diff] [blame] | 69 | readonly attribute float duration; |
| 70 | readonly attribute boolean paused; |
eric.carlson@apple.com | 72a6d93 | 2009-03-23 15:02:34 +0000 | [diff] [blame] | 71 | attribute float defaultPlaybackRate; |
| 72 | attribute float playbackRate; |
antti | 76787a8 | 2007-10-31 01:03:35 +0000 | [diff] [blame] | 73 | readonly attribute TimeRanges played; |
| 74 | readonly attribute TimeRanges seekable; |
| 75 | readonly attribute boolean ended; |
darin@apple.com | d9786f4 | 2010-06-18 16:47:54 +0000 | [diff] [blame] | 76 | attribute [Reflect] boolean autoplay; |
| 77 | attribute [Reflect] boolean loop; |
commit-queue@webkit.org | 62c8e33 | 2011-06-16 18:01:30 +0000 | [diff] [blame] | 78 | void play(); |
| 79 | void pause(); |
antti | 76787a8 | 2007-10-31 01:03:35 +0000 | [diff] [blame] | 80 | |
antti | 76787a8 | 2007-10-31 01:03:35 +0000 | [diff] [blame] | 81 | // controls |
| 82 | attribute boolean controls; |
| 83 | attribute float volume |
| 84 | setter raises (DOMException); |
| 85 | attribute boolean muted; |
eric.carlson@apple.com | cced8be | 2011-09-01 18:10:51 +0000 | [diff] [blame] | 86 | attribute [Reflect=muted] boolean defaultMuted; |
| 87 | |
eric.carlson@apple.com | 8cb301d | 2009-11-12 20:23:15 +0000 | [diff] [blame] | 88 | // WebKit extensions |
beidson@apple.com | d9bfdc8 | 2009-06-23 19:05:30 +0000 | [diff] [blame] | 89 | attribute boolean webkitPreservesPitch; |
eric.carlson@apple.com | 8cb301d | 2009-11-12 20:23:15 +0000 | [diff] [blame] | 90 | |
eric.carlson@apple.com | 9f2f9c6 | 2009-11-19 18:14:01 +0000 | [diff] [blame] | 91 | readonly attribute boolean webkitHasClosedCaptions; |
| 92 | attribute boolean webkitClosedCaptionsVisible; |
dbates@webkit.org | e793e54 | 2011-02-02 19:56:36 +0000 | [diff] [blame] | 93 | |
dbates@webkit.org | e793e54 | 2011-02-02 19:56:36 +0000 | [diff] [blame] | 94 | // The number of bytes consumed by the media decoder. |
paroga@webkit.org | 186b1d7 | 2011-07-22 15:50:35 +0000 | [diff] [blame] | 95 | readonly attribute [Conditional=MEDIA_STATISTICS] unsigned long webkitAudioDecodedByteCount; |
| 96 | readonly attribute [Conditional=MEDIA_STATISTICS] unsigned long webkitVideoDecodedByteCount; |
commit-queue@webkit.org | 7b35231 | 2011-08-30 23:15:56 +0000 | [diff] [blame] | 97 | |
| 98 | #if defined(ENABLE_MEDIA_SOURCE) && ENABLE_MEDIA_SOURCE |
| 99 | // URL passed to src attribute to enable the media source logic. |
commit-queue@webkit.org | f5c71f1 | 2012-04-11 17:32:54 +0000 | [diff] [blame] | 100 | readonly attribute [V8EnabledAtRuntime=mediaSource, URL] DOMString webkitMediaSourceURL; |
commit-queue@webkit.org | 7b35231 | 2011-08-30 23:15:56 +0000 | [diff] [blame] | 101 | |
| 102 | // Appends media to to the source. |
commit-queue@webkit.org | f5c71f1 | 2012-04-11 17:32:54 +0000 | [diff] [blame] | 103 | [V8EnabledAtRuntime=mediaSource] void webkitSourceAppend(in Uint8Array data) raises (DOMException); |
commit-queue@webkit.org | 7b35231 | 2011-08-30 23:15:56 +0000 | [diff] [blame] | 104 | |
| 105 | // Signals the end of stream. |
commit-queue@webkit.org | f5c71f1 | 2012-04-11 17:32:54 +0000 | [diff] [blame] | 106 | [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.org | 7b35231 | 2011-08-30 23:15:56 +0000 | [diff] [blame] | 110 | |
| 111 | // Indicates the current state of the media source. |
commit-queue@webkit.org | f5c71f1 | 2012-04-11 17:32:54 +0000 | [diff] [blame] | 112 | [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.org | 7b35231 | 2011-08-30 23:15:56 +0000 | [diff] [blame] | 116 | #endif |
annacc@chromium.org | ef5d1dc | 2011-10-20 02:53:38 +0000 | [diff] [blame] | 117 | |
commit-queue@webkit.org | a2a07c0 | 2012-04-10 17:47:50 +0000 | [diff] [blame] | 118 | #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.org | ef5d1dc | 2011-10-20 02:53:38 +0000 | [diff] [blame] | 127 | #if defined(ENABLE_VIDEO_TRACK) && ENABLE_VIDEO_TRACK |
haraken@chromium.org | 4cc652f | 2012-02-03 16:53:10 +0000 | [diff] [blame] | 128 | [V8EnabledAtRuntime=webkitVideoTrack] TextTrack addTextTrack(in DOMString kind, in [Optional] DOMString label, in [Optional] DOMString language) |
eric.carlson@apple.com | 892b711 | 2011-11-16 16:05:45 +0000 | [diff] [blame] | 129 | raises (DOMException); |
haraken@chromium.org | 4cc652f | 2012-02-03 16:53:10 +0000 | [diff] [blame] | 130 | readonly attribute [V8EnabledAtRuntime=webkitVideoTrack] TextTrackList textTracks; |
annacc@chromium.org | ef5d1dc | 2011-10-20 02:53:38 +0000 | [diff] [blame] | 131 | #endif |
jer.noble@apple.com | be39c54 | 2011-11-14 17:55:16 +0000 | [diff] [blame] | 132 | |
haraken@chromium.org | f80d78c | 2012-02-21 06:23:57 +0000 | [diff] [blame] | 133 | attribute [Reflect, TreatNullAs=NullString] DOMString mediaGroup; |
jer.noble@apple.com | be39c54 | 2011-11-14 17:55:16 +0000 | [diff] [blame] | 134 | attribute [CustomSetter] MediaController controller; |
antti | 76787a8 | 2007-10-31 01:03:35 +0000 | [diff] [blame] | 135 | }; |
| 136 | } |