HTMLMediaElement.idl 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #import <HTML/AudioTrackList.idl>
  2. #import <HTML/HTMLElement.idl>
  3. #import <HTML/MediaError.idl>
  4. #import <HTML/TimeRanges.idl>
  5. #import <HTML/VideoTrackList.idl>
  6. enum CanPlayTypeResult {
  7. "",
  8. "maybe",
  9. "probably"
  10. };
  11. // https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement
  12. [Exposed=Window]
  13. interface HTMLMediaElement : HTMLElement {
  14. // error state
  15. readonly attribute MediaError? error;
  16. // network state
  17. [Reflect, CEReactions] attribute DOMString src;
  18. // FIXME: attribute MediaProvider? srcObject;
  19. readonly attribute USVString currentSrc;
  20. [Reflect=crossorigin, CEReactions] attribute DOMString? crossOrigin;
  21. const unsigned short NETWORK_EMPTY = 0;
  22. const unsigned short NETWORK_IDLE = 1;
  23. const unsigned short NETWORK_LOADING = 2;
  24. const unsigned short NETWORK_NO_SOURCE = 3;
  25. readonly attribute unsigned short networkState;
  26. // FIXME: [CEReactions] attribute DOMString preload;
  27. readonly attribute TimeRanges buffered;
  28. undefined load();
  29. CanPlayTypeResult canPlayType(DOMString type);
  30. // ready state
  31. const unsigned short HAVE_NOTHING = 0;
  32. const unsigned short HAVE_METADATA = 1;
  33. const unsigned short HAVE_CURRENT_DATA = 2;
  34. const unsigned short HAVE_FUTURE_DATA = 3;
  35. const unsigned short HAVE_ENOUGH_DATA = 4;
  36. readonly attribute unsigned short readyState;
  37. readonly attribute boolean seeking;
  38. // playback state
  39. attribute double currentTime;
  40. undefined fastSeek(double time);
  41. readonly attribute unrestricted double duration;
  42. // FIXME: object getStartDate();
  43. readonly attribute boolean paused;
  44. // FIXME: attribute double defaultPlaybackRate;
  45. // FIXME: attribute double playbackRate;
  46. // FIXME: attribute boolean preservesPitch;
  47. // FIXME: readonly attribute TimeRanges played;
  48. // FIXME: readonly attribute TimeRanges seekable;
  49. readonly attribute boolean ended;
  50. [Reflect, CEReactions] attribute boolean autoplay;
  51. [Reflect, CEReactions] attribute boolean loop;
  52. Promise<undefined> play();
  53. undefined pause();
  54. // controls
  55. [Reflect, CEReactions] attribute boolean controls;
  56. attribute double volume;
  57. attribute boolean muted;
  58. [Reflect=muted, CEReactions] attribute boolean defaultMuted;
  59. // tracks
  60. [SameObject] readonly attribute AudioTrackList audioTracks;
  61. [SameObject] readonly attribute VideoTrackList videoTracks;
  62. // FIXME: [SameObject] readonly attribute TextTrackList textTracks;
  63. // FIXME: TextTrack addTextTrack(TextTrackKind kind, optional DOMString label = "", optional DOMString language = "");
  64. };