2013-03-19 16:25:19 +04:00
|
|
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* The origin of this IDL file is
|
|
|
|
* http://www.whatwg.org/specs/web-apps/current-work/#media-elements
|
|
|
|
*
|
|
|
|
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
|
|
|
|
* Opera Software ASA. You are granted a license to use, reproduce
|
|
|
|
* and create derivative works of this document.
|
|
|
|
*/
|
|
|
|
|
|
|
|
interface HTMLMediaElement : HTMLElement {
|
|
|
|
|
|
|
|
// error state
|
|
|
|
readonly attribute MediaError? error;
|
|
|
|
|
|
|
|
// network state
|
|
|
|
[SetterThrows]
|
|
|
|
attribute DOMString src;
|
|
|
|
readonly attribute DOMString currentSrc;
|
|
|
|
|
|
|
|
[SetterThrows]
|
2014-09-06 06:42:33 +04:00
|
|
|
attribute DOMString? crossOrigin;
|
2013-03-19 16:25:19 +04:00
|
|
|
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;
|
|
|
|
[SetterThrows]
|
|
|
|
attribute DOMString preload;
|
2013-09-30 20:32:22 +04:00
|
|
|
[NewObject]
|
2013-03-19 16:25:19 +04:00
|
|
|
readonly attribute TimeRanges buffered;
|
|
|
|
void load();
|
|
|
|
DOMString canPlayType(DOMString type);
|
|
|
|
|
|
|
|
// 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
|
|
|
|
[SetterThrows]
|
|
|
|
attribute double currentTime;
|
2014-04-01 07:39:04 +04:00
|
|
|
[Throws]
|
|
|
|
void fastSeek(double time);
|
2013-03-19 16:25:19 +04:00
|
|
|
readonly attribute unrestricted double duration;
|
2015-01-27 09:10:11 +03:00
|
|
|
[ChromeOnly]
|
|
|
|
readonly attribute boolean isEncrypted;
|
2013-03-19 16:25:19 +04:00
|
|
|
// TODO: Bug 847376 - readonly attribute any startDate;
|
|
|
|
readonly attribute boolean paused;
|
|
|
|
[SetterThrows]
|
|
|
|
attribute double defaultPlaybackRate;
|
|
|
|
[SetterThrows]
|
|
|
|
attribute double playbackRate;
|
2013-09-30 20:32:22 +04:00
|
|
|
[NewObject]
|
2013-03-19 16:25:19 +04:00
|
|
|
readonly attribute TimeRanges played;
|
2013-09-30 20:32:22 +04:00
|
|
|
[NewObject]
|
2013-03-19 16:25:19 +04:00
|
|
|
readonly attribute TimeRanges seekable;
|
|
|
|
readonly attribute boolean ended;
|
|
|
|
[SetterThrows]
|
|
|
|
attribute boolean autoplay;
|
|
|
|
[SetterThrows]
|
|
|
|
attribute boolean loop;
|
|
|
|
[Throws]
|
2016-12-01 09:54:33 +03:00
|
|
|
Promise<void> play();
|
2013-03-19 16:25:19 +04:00
|
|
|
[Throws]
|
|
|
|
void pause();
|
|
|
|
|
|
|
|
// TODO: Bug 847377 - mediaGroup and MediaController
|
|
|
|
// media controller
|
|
|
|
// attribute DOMString mediaGroup;
|
|
|
|
// attribute MediaController? controller;
|
|
|
|
|
|
|
|
// controls
|
|
|
|
[SetterThrows]
|
|
|
|
attribute boolean controls;
|
|
|
|
[SetterThrows]
|
|
|
|
attribute double volume;
|
|
|
|
attribute boolean muted;
|
|
|
|
[SetterThrows]
|
|
|
|
attribute boolean defaultMuted;
|
|
|
|
|
|
|
|
// TODO: Bug 847379
|
|
|
|
// tracks
|
2014-05-23 13:34:14 +04:00
|
|
|
[Pref="media.track.enabled"]
|
|
|
|
readonly attribute AudioTrackList audioTracks;
|
|
|
|
[Pref="media.track.enabled"]
|
|
|
|
readonly attribute VideoTrackList videoTracks;
|
2015-01-12 14:07:38 +03:00
|
|
|
readonly attribute TextTrackList? textTracks;
|
2013-05-21 20:14:00 +04:00
|
|
|
TextTrack addTextTrack(TextTrackKind kind,
|
|
|
|
optional DOMString label = "",
|
|
|
|
optional DOMString language = "");
|
2013-03-19 16:25:19 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
// Mozilla extensions:
|
|
|
|
partial interface HTMLMediaElement {
|
2017-02-09 22:54:12 +03:00
|
|
|
[Func="HasDebuggerPrivilege"]
|
2015-01-29 05:35:55 +03:00
|
|
|
readonly attribute MediaSource? mozMediaSourceObject;
|
2017-02-09 22:54:12 +03:00
|
|
|
[Func="HasDebuggerPrivilege"]
|
2016-01-18 07:34:48 +03:00
|
|
|
readonly attribute DOMString mozDebugReaderData;
|
2017-02-09 22:54:12 +03:00
|
|
|
[Func="HasDebuggerPrivilege", NewObject]
|
2017-01-18 11:14:57 +03:00
|
|
|
Promise<DOMString> mozRequestDebugInfo();
|
2016-01-18 07:34:48 +03:00
|
|
|
|
2016-04-11 07:02:43 +03:00
|
|
|
[Pref="media.test.dumpDebugInfo"]
|
|
|
|
void mozDumpDebugInfo();
|
|
|
|
|
2015-07-14 07:04:14 +03:00
|
|
|
attribute MediaStream? srcObject;
|
|
|
|
// TODO: remove prefixed version soon (1183495).
|
2013-03-19 16:25:19 +04:00
|
|
|
attribute MediaStream? mozSrcObject;
|
2015-07-14 07:04:14 +03:00
|
|
|
|
2013-03-19 16:25:19 +04:00
|
|
|
attribute boolean mozPreservesPitch;
|
|
|
|
readonly attribute boolean mozAutoplayEnabled;
|
|
|
|
|
2014-06-06 20:33:50 +04:00
|
|
|
// NB: for internal use with the video controls:
|
2014-06-15 01:01:55 +04:00
|
|
|
[Func="IsChromeOrXBL"] attribute boolean mozAllowCasting;
|
|
|
|
[Func="IsChromeOrXBL"] attribute boolean mozIsCasting;
|
2014-06-06 20:33:50 +04:00
|
|
|
|
2013-03-19 16:25:19 +04:00
|
|
|
// Mozilla extension: stream capture
|
2014-12-21 20:06:08 +03:00
|
|
|
[Throws, UnsafeInPrerendering]
|
2013-03-19 16:25:19 +04:00
|
|
|
MediaStream mozCaptureStream();
|
2014-12-21 20:06:08 +03:00
|
|
|
[Throws, UnsafeInPrerendering]
|
2013-03-19 16:25:19 +04:00
|
|
|
MediaStream mozCaptureStreamUntilEnded();
|
|
|
|
readonly attribute boolean mozAudioCaptured;
|
|
|
|
|
|
|
|
// Mozilla extension: return embedded metadata from the stream as a
|
|
|
|
// JSObject with key:value pairs for each tag. This can be used by
|
|
|
|
// player interfaces to display the song title, artist, etc.
|
|
|
|
[Throws]
|
|
|
|
object? mozGetMetadata();
|
|
|
|
|
|
|
|
// Mozilla extension: provides access to the fragment end time if
|
|
|
|
// the media element has a fragment URI for the currentSrc, otherwise
|
|
|
|
// it is equal to the media duration.
|
|
|
|
readonly attribute double mozFragmentEnd;
|
|
|
|
|
|
|
|
// Mozilla extension: an audio channel type for media elements.
|
2013-10-29 04:08:14 +04:00
|
|
|
// Read AudioChannel.webidl for more information about this attribute.
|
2015-07-16 21:34:30 +03:00
|
|
|
[SetterThrows, Pref="media.useAudioChannelAPI"]
|
2013-10-29 04:08:14 +04:00
|
|
|
attribute AudioChannel mozAudioChannelType;
|
2013-03-19 16:25:19 +04:00
|
|
|
|
|
|
|
// In addition the media element has this new events:
|
|
|
|
// * onmozinterruptbegin - called when the media element is interrupted
|
|
|
|
// because of the audiochannel manager.
|
|
|
|
// * onmozinterruptend - called when the interruption is concluded
|
2015-07-16 21:34:30 +03:00
|
|
|
[Pref="media.useAudioChannelAPI"]
|
|
|
|
attribute EventHandler onmozinterruptbegin;
|
|
|
|
|
|
|
|
[Pref="media.useAudioChannelAPI"]
|
|
|
|
attribute EventHandler onmozinterruptend;
|
2013-03-19 16:25:19 +04:00
|
|
|
};
|
2014-06-07 00:52:15 +04:00
|
|
|
|
|
|
|
// Encrypted Media Extensions
|
|
|
|
partial interface HTMLMediaElement {
|
|
|
|
readonly attribute MediaKeys? mediaKeys;
|
2014-07-17 00:54:00 +04:00
|
|
|
|
2014-08-01 07:50:30 +04:00
|
|
|
// void, not any: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26457
|
2017-02-02 09:10:06 +03:00
|
|
|
[NewObject]
|
2014-08-01 07:50:30 +04:00
|
|
|
Promise<void> setMediaKeys(MediaKeys? mediaKeys);
|
2014-07-17 00:54:00 +04:00
|
|
|
|
2014-08-27 12:46:56 +04:00
|
|
|
attribute EventHandler onencrypted;
|
2016-09-21 05:10:26 +03:00
|
|
|
|
|
|
|
attribute EventHandler onwaitingforkey;
|
2014-06-07 00:52:15 +04:00
|
|
|
};
|
2015-07-16 21:34:30 +03:00
|
|
|
|
|
|
|
// This is just for testing
|
|
|
|
partial interface HTMLMediaElement {
|
|
|
|
[Pref="media.useAudioChannelService.testing"]
|
|
|
|
readonly attribute double computedVolume;
|
|
|
|
[Pref="media.useAudioChannelService.testing"]
|
|
|
|
readonly attribute boolean computedMuted;
|
2016-05-03 04:52:53 +03:00
|
|
|
[Pref="media.useAudioChannelService.testing"]
|
|
|
|
readonly attribute unsigned long computedSuspended;
|
2015-07-16 21:34:30 +03:00
|
|
|
};
|
2016-05-24 18:05:59 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* HTMLMediaElement::seekToNextFrame() is a Mozilla experimental feature.
|
|
|
|
*
|
|
|
|
* The SeekToNextFrame() method provides a way to access a video element's video
|
|
|
|
* frames one by one without going through the realtime playback. So, it lets
|
|
|
|
* authors use "frame" as unit to access the video element's underlying data,
|
|
|
|
* instead of "time".
|
|
|
|
*
|
|
|
|
* The SeekToNextFrame() is a kind of seek operation, so normally, once it is
|
|
|
|
* invoked, a "seeking" event is dispatched. However, if the media source has no
|
|
|
|
* video data or is not seekable, the operation is ignored without filing the
|
|
|
|
* "seeking" event.
|
|
|
|
*
|
|
|
|
* Once the SeekToNextFrame() is done, a "seeked" event should always be filed
|
|
|
|
* and a "ended" event might also be filed depends on where the media element's
|
|
|
|
* position before seeking was. There are two cases:
|
|
|
|
* Assume the media source has n+1 video frames where n is a non-negative
|
|
|
|
* integers and the frame sequence is indexed from zero.
|
|
|
|
* (1) If the currentTime is at anywhere smaller than the n-th frame's beginning
|
|
|
|
* time, say the currentTime is now pointing to a position which is smaller
|
|
|
|
* than the x-th frame's beginning time and larger or equal to the (x-1)-th
|
|
|
|
* frame's beginning time, where x belongs to [1, n], then the
|
|
|
|
* SeekToNextFrame() operation seeks the media to the x-th frame, sets the
|
|
|
|
* media's currentTime to the x-th frame's beginning time and dispatches a
|
|
|
|
* "seeked" event.
|
|
|
|
* (2) Otherwise, if the currentTime is larger or equal to the n-th frame's
|
|
|
|
* beginning time, then the SeekToNextFrame() operation sets the media's
|
|
|
|
* currentTime to the duration of the media source and dispatches a "seeked"
|
|
|
|
* event and an "ended" event.
|
|
|
|
*/
|
|
|
|
partial interface HTMLMediaElement {
|
|
|
|
[Throws, Pref="media.seekToNextFrame.enabled"]
|
2016-06-03 11:52:10 +03:00
|
|
|
Promise<void> seekToNextFrame();
|
2016-05-24 18:05:59 +03:00
|
|
|
};
|
2016-07-28 11:09:02 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This is an API for simulating visibility changes to help debug and write
|
|
|
|
* tests about suspend-video-decoding.
|
|
|
|
*/
|
|
|
|
partial interface HTMLMediaElement {
|
|
|
|
[Pref="media.test.setVisible"]
|
|
|
|
void setVisible(boolean aVisible);
|
|
|
|
};
|