dom/webidl/HTMLMediaElement.webidl

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
michael@0 4 * You can obtain one at http://mozilla.org/MPL/2.0/.
michael@0 5 *
michael@0 6 * The origin of this IDL file is
michael@0 7 * http://www.whatwg.org/specs/web-apps/current-work/#media-elements
michael@0 8 *
michael@0 9 * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
michael@0 10 * Opera Software ASA. You are granted a license to use, reproduce
michael@0 11 * and create derivative works of this document.
michael@0 12 */
michael@0 13
michael@0 14 interface HTMLMediaElement : HTMLElement {
michael@0 15
michael@0 16 // error state
michael@0 17 readonly attribute MediaError? error;
michael@0 18
michael@0 19 // network state
michael@0 20 [SetterThrows]
michael@0 21 attribute DOMString src;
michael@0 22 readonly attribute DOMString currentSrc;
michael@0 23
michael@0 24 [SetterThrows]
michael@0 25 attribute DOMString crossOrigin;
michael@0 26 const unsigned short NETWORK_EMPTY = 0;
michael@0 27 const unsigned short NETWORK_IDLE = 1;
michael@0 28 const unsigned short NETWORK_LOADING = 2;
michael@0 29 const unsigned short NETWORK_NO_SOURCE = 3;
michael@0 30 readonly attribute unsigned short networkState;
michael@0 31 [SetterThrows]
michael@0 32 attribute DOMString preload;
michael@0 33 [NewObject]
michael@0 34 readonly attribute TimeRanges buffered;
michael@0 35 void load();
michael@0 36 DOMString canPlayType(DOMString type);
michael@0 37
michael@0 38 // ready state
michael@0 39 const unsigned short HAVE_NOTHING = 0;
michael@0 40 const unsigned short HAVE_METADATA = 1;
michael@0 41 const unsigned short HAVE_CURRENT_DATA = 2;
michael@0 42 const unsigned short HAVE_FUTURE_DATA = 3;
michael@0 43 const unsigned short HAVE_ENOUGH_DATA = 4;
michael@0 44 readonly attribute unsigned short readyState;
michael@0 45 readonly attribute boolean seeking;
michael@0 46
michael@0 47 // playback state
michael@0 48 [SetterThrows]
michael@0 49 attribute double currentTime;
michael@0 50 [Throws]
michael@0 51 void fastSeek(double time);
michael@0 52 readonly attribute unrestricted double duration;
michael@0 53 // TODO: Bug 847376 - readonly attribute any startDate;
michael@0 54 readonly attribute boolean paused;
michael@0 55 [SetterThrows]
michael@0 56 attribute double defaultPlaybackRate;
michael@0 57 [SetterThrows]
michael@0 58 attribute double playbackRate;
michael@0 59 [NewObject]
michael@0 60 readonly attribute TimeRanges played;
michael@0 61 [NewObject]
michael@0 62 readonly attribute TimeRanges seekable;
michael@0 63 readonly attribute boolean ended;
michael@0 64 [SetterThrows]
michael@0 65 attribute boolean autoplay;
michael@0 66 [SetterThrows]
michael@0 67 attribute boolean loop;
michael@0 68 [Throws]
michael@0 69 void play();
michael@0 70 [Throws]
michael@0 71 void pause();
michael@0 72
michael@0 73 // TODO: Bug 847377 - mediaGroup and MediaController
michael@0 74 // media controller
michael@0 75 // attribute DOMString mediaGroup;
michael@0 76 // attribute MediaController? controller;
michael@0 77
michael@0 78 // controls
michael@0 79 [SetterThrows]
michael@0 80 attribute boolean controls;
michael@0 81 [SetterThrows]
michael@0 82 attribute double volume;
michael@0 83 attribute boolean muted;
michael@0 84 [SetterThrows]
michael@0 85 attribute boolean defaultMuted;
michael@0 86
michael@0 87 // TODO: Bug 847379
michael@0 88 // tracks
michael@0 89 //readonly attribute AudioTrackList audioTracks;
michael@0 90 //readonly attribute VideoTrackList videoTracks;
michael@0 91 [Pref="media.webvtt.enabled"]
michael@0 92 readonly attribute TextTrackList textTracks;
michael@0 93 [Pref="media.webvtt.enabled"]
michael@0 94 TextTrack addTextTrack(TextTrackKind kind,
michael@0 95 optional DOMString label = "",
michael@0 96 optional DOMString language = "");
michael@0 97 };
michael@0 98
michael@0 99 // Mozilla extensions:
michael@0 100 partial interface HTMLMediaElement {
michael@0 101 attribute MediaStream? mozSrcObject;
michael@0 102 attribute boolean mozPreservesPitch;
michael@0 103 readonly attribute boolean mozAutoplayEnabled;
michael@0 104
michael@0 105 // NB: for internal use with the video controls:
michael@0 106 [Func="IsChromeOrXBL"] attribute boolean mozMediaStatisticsShowing;
michael@0 107 [Func="IsChromeOrXBL"] attribute boolean mozAllowCasting;
michael@0 108 [Func="IsChromeOrXBL"] attribute boolean mozIsCasting;
michael@0 109
michael@0 110 // Mozilla extension: stream capture
michael@0 111 [Throws]
michael@0 112 MediaStream mozCaptureStream();
michael@0 113 [Throws]
michael@0 114 MediaStream mozCaptureStreamUntilEnded();
michael@0 115 readonly attribute boolean mozAudioCaptured;
michael@0 116
michael@0 117 // Mozilla extension: return embedded metadata from the stream as a
michael@0 118 // JSObject with key:value pairs for each tag. This can be used by
michael@0 119 // player interfaces to display the song title, artist, etc.
michael@0 120 [Throws]
michael@0 121 object? mozGetMetadata();
michael@0 122
michael@0 123 // Mozilla extension: provides access to the fragment end time if
michael@0 124 // the media element has a fragment URI for the currentSrc, otherwise
michael@0 125 // it is equal to the media duration.
michael@0 126 readonly attribute double mozFragmentEnd;
michael@0 127
michael@0 128 // Mozilla extension: an audio channel type for media elements.
michael@0 129 // Read AudioChannel.webidl for more information about this attribute.
michael@0 130 [SetterThrows]
michael@0 131 attribute AudioChannel mozAudioChannelType;
michael@0 132
michael@0 133 // In addition the media element has this new events:
michael@0 134 // * onmozinterruptbegin - called when the media element is interrupted
michael@0 135 // because of the audiochannel manager.
michael@0 136 // * onmozinterruptend - called when the interruption is concluded
michael@0 137 };

mercurial