Auto merge of #8454 - jdm:media, r=KiChjang

Implement basic <media> infrastructure

This gets us to the point where we can start playing with actually integrating rust-media to process the data received by the network request, as currently it's just ignored.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8454)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-05-03 16:42:46 -07:00
commit f9d9cd3aae
108 changed files with 1957 additions and 1265 deletions

View file

@ -20,26 +20,40 @@ callback OnErrorEventHandlerNonNull = any ((Event or DOMString) event, optional
optional any error);
typedef OnErrorEventHandlerNonNull? OnErrorEventHandler;
// https://html.spec.whatwg.org/multipage/#globaleventhandlers
[NoInterfaceObject]
interface GlobalEventHandlers {
attribute EventHandler onabort;
attribute EventHandler onblur;
attribute EventHandler oncanplay;
attribute EventHandler oncanplaythrough;
attribute EventHandler onchange;
attribute EventHandler onclick;
attribute EventHandler ondblclick;
attribute EventHandler onemptied;
attribute OnErrorEventHandler onerror;
attribute EventHandler oninput;
attribute EventHandler onkeydown;
attribute EventHandler onkeypress;
attribute EventHandler onkeyup;
attribute EventHandler onload;
attribute EventHandler onloadeddata;
attribute EventHandler onloadedmetadata;
attribute EventHandler onmouseover;
attribute EventHandler onpause;
attribute EventHandler onplay;
attribute EventHandler onplaying;
attribute EventHandler onprogress;
attribute EventHandler onreset;
attribute EventHandler onresize;
attribute EventHandler onsubmit;
attribute EventHandler onsuspend;
attribute EventHandler ontimeupdate;
attribute EventHandler ontoggle;
attribute EventHandler onwaiting;
};
// https://html.spec.whatwg.org/multipage/#windoweventhandlers
[NoInterfaceObject]
interface WindowEventHandlers {
attribute EventHandler onunload;

View file

@ -3,34 +3,34 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// https://html.spec.whatwg.org/multipage/#htmlmediaelement
//enum CanPlayTypeResult { "" /* empty string */, "maybe", "probably" };
enum CanPlayTypeResult { "" /* empty string */, "maybe", "probably" };
[Abstract]
interface HTMLMediaElement : HTMLElement {
// error state
//readonly attribute MediaError? error;
readonly attribute MediaError? error;
// network state
// attribute DOMString src;
//readonly attribute DOMString currentSrc;
attribute DOMString src;
readonly attribute DOMString currentSrc;
// attribute DOMString crossOrigin;
//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;
// attribute DOMString preload;
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;
attribute DOMString preload;
//readonly attribute TimeRanges buffered;
//void load();
//CanPlayTypeResult canPlayType(DOMString type);
void load();
CanPlayTypeResult 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;
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
@ -38,16 +38,16 @@ interface HTMLMediaElement : HTMLElement {
//void fastSeek(double time);
//readonly attribute unrestricted double duration;
//Date getStartDate();
//readonly attribute boolean paused;
readonly attribute boolean paused;
// attribute double defaultPlaybackRate;
// attribute double playbackRate;
//readonly attribute TimeRanges played;
//readonly attribute TimeRanges seekable;
//readonly attribute boolean ended;
// attribute boolean autoplay;
attribute boolean autoplay;
// attribute boolean loop;
//void play();
//void pause();
void play();
void pause();
// media controller
// attribute DOMString mediaGroup;

View file

@ -0,0 +1,13 @@
/* 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/. */
// https://html.spec.whatwg.org/multipage/#mediaerror
interface MediaError {
const unsigned short MEDIA_ERR_ABORTED = 1;
const unsigned short MEDIA_ERR_NETWORK = 2;
const unsigned short MEDIA_ERR_DECODE = 3;
const unsigned short MEDIA_ERR_SRC_NOT_SUPPORTED = 4;
readonly attribute unsigned short code;
};