1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/webidl/HTMLMediaElement.webidl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,137 @@ 1.4 +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this file, 1.7 + * You can obtain one at http://mozilla.org/MPL/2.0/. 1.8 + * 1.9 + * The origin of this IDL file is 1.10 + * http://www.whatwg.org/specs/web-apps/current-work/#media-elements 1.11 + * 1.12 + * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and 1.13 + * Opera Software ASA. You are granted a license to use, reproduce 1.14 + * and create derivative works of this document. 1.15 + */ 1.16 + 1.17 +interface HTMLMediaElement : HTMLElement { 1.18 + 1.19 + // error state 1.20 + readonly attribute MediaError? error; 1.21 + 1.22 + // network state 1.23 + [SetterThrows] 1.24 + attribute DOMString src; 1.25 + readonly attribute DOMString currentSrc; 1.26 + 1.27 + [SetterThrows] 1.28 + attribute DOMString crossOrigin; 1.29 + const unsigned short NETWORK_EMPTY = 0; 1.30 + const unsigned short NETWORK_IDLE = 1; 1.31 + const unsigned short NETWORK_LOADING = 2; 1.32 + const unsigned short NETWORK_NO_SOURCE = 3; 1.33 + readonly attribute unsigned short networkState; 1.34 + [SetterThrows] 1.35 + attribute DOMString preload; 1.36 + [NewObject] 1.37 + readonly attribute TimeRanges buffered; 1.38 + void load(); 1.39 + DOMString canPlayType(DOMString type); 1.40 + 1.41 + // ready state 1.42 + const unsigned short HAVE_NOTHING = 0; 1.43 + const unsigned short HAVE_METADATA = 1; 1.44 + const unsigned short HAVE_CURRENT_DATA = 2; 1.45 + const unsigned short HAVE_FUTURE_DATA = 3; 1.46 + const unsigned short HAVE_ENOUGH_DATA = 4; 1.47 + readonly attribute unsigned short readyState; 1.48 + readonly attribute boolean seeking; 1.49 + 1.50 + // playback state 1.51 + [SetterThrows] 1.52 + attribute double currentTime; 1.53 + [Throws] 1.54 + void fastSeek(double time); 1.55 + readonly attribute unrestricted double duration; 1.56 + // TODO: Bug 847376 - readonly attribute any startDate; 1.57 + readonly attribute boolean paused; 1.58 + [SetterThrows] 1.59 + attribute double defaultPlaybackRate; 1.60 + [SetterThrows] 1.61 + attribute double playbackRate; 1.62 + [NewObject] 1.63 + readonly attribute TimeRanges played; 1.64 + [NewObject] 1.65 + readonly attribute TimeRanges seekable; 1.66 + readonly attribute boolean ended; 1.67 + [SetterThrows] 1.68 + attribute boolean autoplay; 1.69 + [SetterThrows] 1.70 + attribute boolean loop; 1.71 + [Throws] 1.72 + void play(); 1.73 + [Throws] 1.74 + void pause(); 1.75 + 1.76 + // TODO: Bug 847377 - mediaGroup and MediaController 1.77 + // media controller 1.78 + // attribute DOMString mediaGroup; 1.79 + // attribute MediaController? controller; 1.80 + 1.81 + // controls 1.82 + [SetterThrows] 1.83 + attribute boolean controls; 1.84 + [SetterThrows] 1.85 + attribute double volume; 1.86 + attribute boolean muted; 1.87 + [SetterThrows] 1.88 + attribute boolean defaultMuted; 1.89 + 1.90 + // TODO: Bug 847379 1.91 + // tracks 1.92 + //readonly attribute AudioTrackList audioTracks; 1.93 + //readonly attribute VideoTrackList videoTracks; 1.94 + [Pref="media.webvtt.enabled"] 1.95 + readonly attribute TextTrackList textTracks; 1.96 + [Pref="media.webvtt.enabled"] 1.97 + TextTrack addTextTrack(TextTrackKind kind, 1.98 + optional DOMString label = "", 1.99 + optional DOMString language = ""); 1.100 +}; 1.101 + 1.102 +// Mozilla extensions: 1.103 +partial interface HTMLMediaElement { 1.104 + attribute MediaStream? mozSrcObject; 1.105 + attribute boolean mozPreservesPitch; 1.106 + readonly attribute boolean mozAutoplayEnabled; 1.107 + 1.108 + // NB: for internal use with the video controls: 1.109 + [Func="IsChromeOrXBL"] attribute boolean mozMediaStatisticsShowing; 1.110 + [Func="IsChromeOrXBL"] attribute boolean mozAllowCasting; 1.111 + [Func="IsChromeOrXBL"] attribute boolean mozIsCasting; 1.112 + 1.113 + // Mozilla extension: stream capture 1.114 + [Throws] 1.115 + MediaStream mozCaptureStream(); 1.116 + [Throws] 1.117 + MediaStream mozCaptureStreamUntilEnded(); 1.118 + readonly attribute boolean mozAudioCaptured; 1.119 + 1.120 + // Mozilla extension: return embedded metadata from the stream as a 1.121 + // JSObject with key:value pairs for each tag. This can be used by 1.122 + // player interfaces to display the song title, artist, etc. 1.123 + [Throws] 1.124 + object? mozGetMetadata(); 1.125 + 1.126 + // Mozilla extension: provides access to the fragment end time if 1.127 + // the media element has a fragment URI for the currentSrc, otherwise 1.128 + // it is equal to the media duration. 1.129 + readonly attribute double mozFragmentEnd; 1.130 + 1.131 + // Mozilla extension: an audio channel type for media elements. 1.132 + // Read AudioChannel.webidl for more information about this attribute. 1.133 + [SetterThrows] 1.134 + attribute AudioChannel mozAudioChannelType; 1.135 + 1.136 + // In addition the media element has this new events: 1.137 + // * onmozinterruptbegin - called when the media element is interrupted 1.138 + // because of the audiochannel manager. 1.139 + // * onmozinterruptend - called when the interruption is concluded 1.140 +};