HTMLMediaElement.idl 2.9 KB

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