1/* 2 * Copyright (C) 2007, 2010, 2011, 2012 Apple Inc. All rights reserved. 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[ 27 Conditional=VIDEO, 28 JSGenerateToNativeObject, 29 ActiveDOMObject 30] interface HTMLMediaElement : HTMLElement { 31 32// error state 33readonly attribute MediaError error; 34 35// network state 36[Reflect, URL] attribute DOMString src; 37[URL] readonly attribute DOMString currentSrc; 38 39const unsigned short NETWORK_EMPTY = 0; 40const unsigned short NETWORK_IDLE = 1; 41const unsigned short NETWORK_LOADING = 2; 42const unsigned short NETWORK_NO_SOURCE = 3; 43readonly attribute unsigned short networkState; 44attribute DOMString preload; 45 46readonly attribute TimeRanges buffered; 47void load(); 48#if defined(ENABLE_ENCRYPTED_MEDIA) && ENABLE_ENCRYPTED_MEDIA 49 DOMString canPlayType([Default=Undefined] optional DOMString type, [Default=Undefined, TreatNullAs=NullString, TreatUndefinedAs=NullString] optional DOMString keySystem); 50#elif defined(ENABLE_ENCRYPTED_MEDIA_V2) && ENABLE_ENCRYPTED_MEDIA_V2 51 DOMString canPlayType([Default=Undefined] optional DOMString type, [Default=Undefined, TreatNullAs=NullString, TreatUndefinedAs=NullString] optional DOMString keySystem); 52#else 53DOMString canPlayType([Default=Undefined] optional DOMString type); 54#endif 55 56// ready state 57const unsigned short HAVE_NOTHING = 0; 58const unsigned short HAVE_METADATA = 1; 59const unsigned short HAVE_CURRENT_DATA = 2; 60const unsigned short HAVE_FUTURE_DATA = 3; 61const unsigned short HAVE_ENOUGH_DATA = 4; 62readonly attribute unsigned short readyState; 63readonly attribute boolean seeking; 64 65// playback state 66[SetterRaisesException] attribute double currentTime; 67readonly attribute double initialTime; 68readonly attribute double startTime; 69readonly attribute double duration; 70readonly attribute boolean paused; 71attribute double defaultPlaybackRate; 72attribute double playbackRate; 73readonly attribute TimeRanges played; 74readonly attribute TimeRanges seekable; 75readonly attribute boolean ended; 76[Reflect] attribute boolean autoplay; 77[Reflect] attribute boolean loop; 78void play(); 79void pause(); 80 81// controls 82attribute boolean controls; 83[SetterRaisesException] attribute double volume; 84attribute boolean muted; 85[Reflect=muted] attribute boolean defaultMuted; 86 87// WebKit extensions 88attribute boolean webkitPreservesPitch; 89 90readonly attribute boolean webkitHasClosedCaptions; 91attribute boolean webkitClosedCaptionsVisible; 92 93// The number of bytes consumed by the media decoder. 94[Conditional=MEDIA_STATISTICS] readonly attribute unsigned long webkitAudioDecodedByteCount; 95[Conditional=MEDIA_STATISTICS] readonly attribute unsigned long webkitVideoDecodedByteCount; 96 97#if defined(ENABLE_ENCRYPTED_MEDIA) && ENABLE_ENCRYPTED_MEDIA 98[RaisesException] void webkitGenerateKeyRequest([TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString keySystem, optional Uint8Array initData); 99[RaisesException] void webkitAddKey([TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString keySystem, Uint8Array key, optional Uint8Array initData, [Default=NullString] optional DOMString sessionId); 100[RaisesException] void webkitCancelKeyRequest([TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString keySystem, [Default=NullString] optional DOMString sessionId); 101 102 attribute EventListener onwebkitkeyadded; 103 attribute EventListener onwebkitkeyerror; 104 attribute EventListener onwebkitkeymessage; 105#endif 106 [Conditional=ENCRYPTED_MEDIA|ENCRYPTED_MEDIA_V2] attribute EventListener onwebkitneedkey; 107#if defined(ENABLE_ENCRYPTED_MEDIA_V2) && ENABLE_ENCRYPTED_MEDIA_V2 108 [ImplementedAs=keys] readonly attribute MediaKeys webkitKeys; 109 [ImplementedAs=setMediaKeys] void webkitSetMediaKeys(MediaKeys mediaKeys); 110#endif 111 112#if defined(ENABLE_VIDEO_TRACK) && ENABLE_VIDEO_TRACK 113[RaisesException] TextTrack addTextTrack(DOMString kind, optional DOMString label, optional DOMString language); 114readonly attribute AudioTrackList audioTracks; 115readonly attribute TextTrackList textTracks; 116readonly attribute VideoTrackList videoTracks; 117#endif 118 119[Reflect, TreatNullAs=NullString] attribute DOMString mediaGroup; 120[CustomSetter] attribute MediaController controller; 121}; 122