nsIDOMHTMLMediaElement.idl 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* vim:set ts=2 sw=2 sts=2 et cindent: */
  3. /* This Source Code Form is subject to the terms of the Mozilla Public
  4. * License, v. 2.0. If a copy of the MPL was not distributed with this
  5. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  6. #include "nsIDOMHTMLElement.idl"
  7. #include "nsIDOMTimeRanges.idl"
  8. /**
  9. * The nsIDOMHTMLMediaElement interface is an interface to be implemented by the HTML
  10. * <audio> and <video> elements.
  11. *
  12. * For more information on this interface, please see
  13. * http://www.whatwg.org/specs/web-apps/current-work/#htmlmediaelement
  14. *
  15. * @status UNDER_DEVELOPMENT
  16. */
  17. // undef the GetCurrentTime macro defined in WinBase.h from the MS Platform SDK
  18. %{C++
  19. #ifdef GetCurrentTime
  20. #undef GetCurrentTime
  21. #endif
  22. #include "Visibility.h"
  23. %}
  24. native Visibility(mozilla::Visibility);
  25. [uuid(c041d76c-15ce-47ad-b61d-e8755a6db638)]
  26. interface nsIDOMHTMLMediaElement : nsISupports
  27. {
  28. // network state
  29. attribute DOMString src;
  30. readonly attribute DOMString currentSrc;
  31. const unsigned short NETWORK_EMPTY = 0;
  32. const unsigned short NETWORK_IDLE = 1;
  33. const unsigned short NETWORK_LOADING = 2;
  34. const unsigned short NETWORK_NO_SOURCE = 3;
  35. readonly attribute unsigned short networkState;
  36. attribute DOMString preload;
  37. readonly attribute nsIDOMTimeRanges buffered;
  38. void load();
  39. DOMString canPlayType(in DOMString type);
  40. // ready state
  41. const unsigned short HAVE_NOTHING = 0;
  42. const unsigned short HAVE_METADATA = 1;
  43. const unsigned short HAVE_CURRENT_DATA = 2;
  44. const unsigned short HAVE_FUTURE_DATA = 3;
  45. const unsigned short HAVE_ENOUGH_DATA = 4;
  46. readonly attribute unsigned short readyState;
  47. readonly attribute boolean seeking;
  48. // playback state
  49. attribute double currentTime;
  50. readonly attribute double duration;
  51. readonly attribute boolean paused;
  52. attribute double defaultPlaybackRate;
  53. attribute double playbackRate;
  54. attribute boolean mozPreservesPitch;
  55. readonly attribute nsIDOMTimeRanges played;
  56. readonly attribute nsIDOMTimeRanges seekable;
  57. readonly attribute boolean ended;
  58. readonly attribute boolean mozAutoplayEnabled;
  59. attribute boolean autoplay;
  60. attribute boolean loop;
  61. void play();
  62. void pause();
  63. // controls
  64. attribute boolean controls;
  65. attribute double volume;
  66. attribute boolean muted;
  67. attribute boolean defaultMuted;
  68. // Mozilla extension: stream capture
  69. readonly attribute boolean mozAudioCaptured;
  70. // Mozilla extension: return embedded metadata from the stream as a
  71. // JSObject with key:value pairs for each tag. This can be used by
  72. // player interfaces to display the song title, artist, etc.
  73. [implicit_jscontext]
  74. jsval mozGetMetadata();
  75. // Mozilla extension: provides access to the fragment end time if
  76. // the media element has a fragment URI for the currentSrc, otherwise
  77. // it is equal to the media duration.
  78. readonly attribute double mozFragmentEnd;
  79. // Mozilla extension: an audio channel type for media elements.
  80. // An exception is thrown if the app tries to change the audio channel type
  81. // without the permission (manifest file for B2G apps).
  82. // The supported values are:
  83. // * normal (default value)
  84. // Automatically paused if "notification" or higher priority channel
  85. // is played
  86. // Use case: normal applications
  87. // * content
  88. // Automatically paused if "notification" or higher priority channel
  89. // is played. Also paused if another app starts using "content"
  90. // channel. Using this channel never affects applications using
  91. // the "normal" channel.
  92. // Use case: video/audio players
  93. // * notification
  94. // Automatically paused if "alarm" or higher priority channel is played.
  95. // Use case: New email, incoming SMS
  96. // * alarm
  97. // Automatically paused if "telephony" or higher priority channel is
  98. // played.
  99. // User case: Alarm clock, calendar alarms
  100. // * telephony
  101. // Automatically paused if "ringer" or higher priority
  102. // channel is played.
  103. // Use case: dialer, voip
  104. // * ringer
  105. // Automatically paused if "publicnotification" or higher priority
  106. // channel is played.
  107. // Use case: dialer, voip
  108. // * publicnotification
  109. // Always plays in speaker, even when headphones are plugged in.
  110. // Use case: Camera shutter sound.
  111. attribute DOMString mozAudioChannelType;
  112. // In addition the media element has this new events:
  113. // * onmozinterruptbegin - called when the media element is interrupted
  114. // because of the audiochannel manager.
  115. // * onmozinterruptend - called when the interruption is concluded
  116. [notxpcom] boolean isVideo();
  117. /**
  118. * Called by layout to announce when the frame associated with this content
  119. * has changed its visibility state.
  120. *
  121. * @param aOldVisibility The previous visibility state.
  122. * @param aNewVisibility The new visibility state.
  123. */
  124. [noscript, notxpcom] void onVisibilityChange(in Visibility aNewVisibility);
  125. };