| // Copyright 2015 Google Inc. All Rights Reserved. |
| // |
| // Licensed under the Apache License, Version 2.0 (the "License"); |
| // you may not use this file except in compliance with the License. |
| // You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, software |
| // distributed under the License is distributed on an "AS IS" BASIS, |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| |
| // https://www.w3.org/TR/html5/embedded-content-0.html#media-elements |
| |
| interface HTMLMediaElement : HTMLElement { |
| // error state |
| readonly attribute MediaError? error; |
| |
| // network state |
| attribute DOMString src; |
| readonly attribute DOMString currentSrc; |
| const unsigned short NETWORK_EMPTY = 0; |
| const unsigned short NETWORK_IDLE = 1; |
| const unsigned short NETWORK_LOADING = 2; |
| const unsigned short NETWORK_NO_SOURCE = 3; |
| readonly attribute unsigned short networkState; |
| readonly attribute TimeRanges buffered; |
| void load(); |
| // The keySystem argument is an extension defined in Encrypted Media Extensions. |
| // https://dvcs.w3.org/hg/html-media/raw-file/eme-v0.1b/encrypted-media/encrypted-media.html#dom-canplaytype |
| DOMString canPlayType(DOMString type, optional DOMString keySystem); |
| |
| // ready state |
| const unsigned short HAVE_NOTHING = 0; |
| const unsigned short HAVE_METADATA = 1; |
| const unsigned short HAVE_CURRENT_DATA = 2; |
| const unsigned short HAVE_FUTURE_DATA = 3; |
| const unsigned short HAVE_ENOUGH_DATA = 4; |
| readonly attribute unsigned short readyState; |
| readonly attribute boolean seeking; |
| |
| // playback state |
| [RaisesException] attribute double currentTime; |
| readonly attribute double duration; |
| readonly attribute boolean paused; |
| attribute double defaultPlaybackRate; |
| attribute double playbackRate; |
| readonly attribute TimeRanges played; |
| readonly attribute TimeRanges seekable; |
| readonly attribute boolean ended; |
| attribute boolean autoplay; |
| attribute boolean loop; |
| void play(); |
| void pause(); |
| |
| // controls |
| attribute boolean controls; |
| [RaisesException] attribute double volume; |
| attribute boolean muted; |
| |
| // Encrypted Media Extensions methods |
| [RaisesException] void generateKeyRequest(DOMString keySystem, |
| Uint8Array? initData); |
| [RaisesException] void addKey(DOMString keySystem, Uint8Array key, |
| Uint8Array? initData, DOMString? sessionId); |
| [RaisesException] void cancelKeyRequest(DOMString keySystem, |
| DOMString? sessionId); |
| }; |