dom/interfaces/html/nsIDOMHTMLMediaElement.idl

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: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
michael@0 3 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #include "nsIDOMHTMLElement.idl"
michael@0 8 #include "nsIDOMMediaError.idl"
michael@0 9 #include "nsIDOMTimeRanges.idl"
michael@0 10
michael@0 11 interface nsIDOMMediaStream;
michael@0 12
michael@0 13 /**
michael@0 14 * The nsIDOMHTMLMediaElement interface is an interface to be implemented by the HTML
michael@0 15 * <audio> and <video> elements.
michael@0 16 *
michael@0 17 * For more information on this interface, please see
michael@0 18 * http://www.whatwg.org/specs/web-apps/current-work/#htmlmediaelement
michael@0 19 *
michael@0 20 * @status UNDER_DEVELOPMENT
michael@0 21 */
michael@0 22
michael@0 23 // undef the GetCurrentTime macro defined in WinBase.h from the MS Platform SDK
michael@0 24 %{C++
michael@0 25 #ifdef GetCurrentTime
michael@0 26 #undef GetCurrentTime
michael@0 27 #endif
michael@0 28 %}
michael@0 29
michael@0 30 [scriptable, uuid(1f9393e8-2df0-4072-87b9-c26999b09acc)]
michael@0 31 interface nsIDOMHTMLMediaElement : nsISupports
michael@0 32 {
michael@0 33 // error state
michael@0 34 readonly attribute nsIDOMMediaError error;
michael@0 35
michael@0 36 // network state
michael@0 37 attribute DOMString src;
michael@0 38 attribute nsIDOMMediaStream mozSrcObject;
michael@0 39 readonly attribute DOMString currentSrc;
michael@0 40 attribute DOMString crossOrigin;
michael@0 41 const unsigned short NETWORK_EMPTY = 0;
michael@0 42 const unsigned short NETWORK_IDLE = 1;
michael@0 43 const unsigned short NETWORK_LOADING = 2;
michael@0 44 const unsigned short NETWORK_NO_SOURCE = 3;
michael@0 45 readonly attribute unsigned short networkState;
michael@0 46 attribute DOMString preload;
michael@0 47 readonly attribute nsIDOMTimeRanges buffered;
michael@0 48 void load();
michael@0 49 DOMString canPlayType(in DOMString type);
michael@0 50
michael@0 51 // ready state
michael@0 52 const unsigned short HAVE_NOTHING = 0;
michael@0 53 const unsigned short HAVE_METADATA = 1;
michael@0 54 const unsigned short HAVE_CURRENT_DATA = 2;
michael@0 55 const unsigned short HAVE_FUTURE_DATA = 3;
michael@0 56 const unsigned short HAVE_ENOUGH_DATA = 4;
michael@0 57 readonly attribute unsigned short readyState;
michael@0 58 readonly attribute boolean seeking;
michael@0 59
michael@0 60 // playback state
michael@0 61 attribute double currentTime;
michael@0 62 readonly attribute double duration;
michael@0 63 readonly attribute boolean paused;
michael@0 64 attribute double defaultPlaybackRate;
michael@0 65 attribute double playbackRate;
michael@0 66 attribute boolean mozPreservesPitch;
michael@0 67 readonly attribute nsIDOMTimeRanges played;
michael@0 68 readonly attribute nsIDOMTimeRanges seekable;
michael@0 69 readonly attribute boolean ended;
michael@0 70 readonly attribute boolean mozAutoplayEnabled;
michael@0 71 attribute boolean autoplay;
michael@0 72 attribute boolean loop;
michael@0 73 void play();
michael@0 74 void pause();
michael@0 75
michael@0 76 // controls
michael@0 77 attribute boolean controls;
michael@0 78 attribute double volume;
michael@0 79 attribute boolean muted;
michael@0 80 attribute boolean defaultMuted;
michael@0 81
michael@0 82 // Mozilla extension: stream capture
michael@0 83 nsIDOMMediaStream mozCaptureStream();
michael@0 84 nsIDOMMediaStream mozCaptureStreamUntilEnded();
michael@0 85 readonly attribute boolean mozAudioCaptured;
michael@0 86
michael@0 87 // Mozilla extension: return embedded metadata from the stream as a
michael@0 88 // JSObject with key:value pairs for each tag. This can be used by
michael@0 89 // player interfaces to display the song title, artist, etc.
michael@0 90 [implicit_jscontext]
michael@0 91 jsval mozGetMetadata();
michael@0 92
michael@0 93 // Mozilla extension: provides access to the fragment end time if
michael@0 94 // the media element has a fragment URI for the currentSrc, otherwise
michael@0 95 // it is equal to the media duration.
michael@0 96 readonly attribute double mozFragmentEnd;
michael@0 97
michael@0 98 // Mozilla extension: an audio channel type for media elements.
michael@0 99 // An exception is thrown if the app tries to change the audio channel type
michael@0 100 // without the permission (manifest file for B2G apps).
michael@0 101 // The supported values are:
michael@0 102 // * normal (default value)
michael@0 103 // Automatically paused if "notification" or higher priority channel
michael@0 104 // is played
michael@0 105 // Use case: normal applications
michael@0 106 // * content
michael@0 107 // Automatically paused if "notification" or higher priority channel
michael@0 108 // is played. Also paused if another app starts using "content"
michael@0 109 // channel. Using this channel never affects applications using
michael@0 110 // the "normal" channel.
michael@0 111 // Use case: video/audio players
michael@0 112 // * notification
michael@0 113 // Automatically paused if "alarm" or higher priority channel is played.
michael@0 114 // Use case: New email, incoming SMS
michael@0 115 // * alarm
michael@0 116 // Automatically paused if "telephony" or higher priority channel is
michael@0 117 // played.
michael@0 118 // User case: Alarm clock, calendar alarms
michael@0 119 // * telephony
michael@0 120 // Automatically paused if "ringer" or higher priority
michael@0 121 // channel is played.
michael@0 122 // Use case: dialer, voip
michael@0 123 // * ringer
michael@0 124 // Automatically paused if "publicnotification" or higher priority
michael@0 125 // channel is played.
michael@0 126 // Use case: dialer, voip
michael@0 127 // * publicnotification
michael@0 128 // Always plays in speaker, even when headphones are plugged in.
michael@0 129 // Use case: Camera shutter sound.
michael@0 130 attribute DOMString mozAudioChannelType;
michael@0 131
michael@0 132 // In addition the media element has this new events:
michael@0 133 // * onmozinterruptbegin - called when the media element is interrupted
michael@0 134 // because of the audiochannel manager.
michael@0 135 // * onmozinterruptend - called when the interruption is concluded
michael@0 136 };

mercurial