HTMLMediaElement.idl 2.6 KB

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