MediaElement.hx 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. /*
  2. * Copyright (C)2005-2018 Haxe Foundation
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  20. * DEALINGS IN THE SOFTWARE.
  21. */
  22. // This file is generated from mozilla\HTMLMediaElement.webidl. Do not edit!
  23. package js.html;
  24. /**
  25. The `HTMLMediaElement` interface adds to `HTMLElement` the properties and methods needed to support basic media-related capabilities that are common to audio and video. The `HTMLVideoElement` and `HTMLAudioElement` elements both inherit this interface.
  26. Documentation [HTMLMediaElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
  27. @see <https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement>
  28. **/
  29. @:native("HTMLMediaElement")
  30. extern class MediaElement extends Element
  31. {
  32. static inline var NETWORK_EMPTY : Int = 0;
  33. static inline var NETWORK_IDLE : Int = 1;
  34. static inline var NETWORK_LOADING : Int = 2;
  35. static inline var NETWORK_NO_SOURCE : Int = 3;
  36. static inline var HAVE_NOTHING : Int = 0;
  37. static inline var HAVE_METADATA : Int = 1;
  38. static inline var HAVE_CURRENT_DATA : Int = 2;
  39. static inline var HAVE_FUTURE_DATA : Int = 3;
  40. static inline var HAVE_ENOUGH_DATA : Int = 4;
  41. /**
  42. Returns a `MediaError` object for the most recent error, or `null` if there has not been an error.
  43. **/
  44. var error(default,null) : MediaError;
  45. /**
  46. Is a `DOMString` that reflects the `src` HTML attribute, which contains the URL of a media resource to use.
  47. **/
  48. var src : String;
  49. /**
  50. Returns a `DOMString` with the absolute URL of the chosen media resource.
  51. **/
  52. var currentSrc(default,null) : String;
  53. /**
  54. Is a `DOMString` indicating the CORS setting for this media element.
  55. **/
  56. var crossOrigin : String;
  57. /**
  58. Returns a `unsigned short` (enumeration) indicating the current state of fetching the media over the network.
  59. **/
  60. var networkState(default,null) : Int;
  61. /**
  62. Is a `DOMString` that reflects the `preload` HTML attribute, indicating what data should be preloaded, if any. Possible values are: `none`, `metadata`, `auto`.
  63. **/
  64. var preload : String;
  65. /**
  66. Returns a `TimeRanges` object that indicates the ranges of the media source that the browser has buffered (if any) at the moment the `buffered` property is accessed.
  67. **/
  68. var buffered(default,null) : TimeRanges;
  69. /**
  70. Returns a `unsigned short` (enumeration) indicating the readiness state of the media.
  71. **/
  72. var readyState(default,null) : Int;
  73. /**
  74. Returns a `Boolean` that indicates whether the media is in the process of seeking to a new position.
  75. **/
  76. var seeking(default,null) : Bool;
  77. /**
  78. Is a `double` indicating the current playback time in seconds. Setting this value seeks the media to the new time.
  79. **/
  80. var currentTime : Float;
  81. /**
  82. Returns a `double` indicating the length of the media in seconds, or 0 if no media data is available.
  83. **/
  84. var duration(default,null) : Float;
  85. /**
  86. Returns a `Boolean` that indicates whether the media element is paused.
  87. **/
  88. var paused(default,null) : Bool;
  89. /**
  90. Is a `double` indicating the default playback rate for the media.
  91. **/
  92. var defaultPlaybackRate : Float;
  93. /**
  94. Is a `double` that indicates the rate at which the media is being played back. 
  95. **/
  96. var playbackRate : Float;
  97. /**
  98. Returns a `TimeRanges` object that contains the ranges of the media source that the browser has played, if any.
  99. **/
  100. var played(default,null) : TimeRanges;
  101. /**
  102. Returns a `TimeRanges` object that contains the time ranges that the user is able to seek to, if any.
  103. **/
  104. var seekable(default,null) : TimeRanges;
  105. /**
  106. Returns a `Boolean` that indicates whether the media element has finished playing.
  107. **/
  108. var ended(default,null) : Bool;
  109. /**
  110. Is a `Boolean` that reflects the `autoplay` HTML attribute, indicating whether playback should automatically begin as soon as enough media is available to do so without interruption.
  111. **/
  112. var autoplay : Bool;
  113. /**
  114. Is a `Boolean` that reflects the `loop` HTML attribute, which indicates whether the media element should start over when it reaches the end.
  115. **/
  116. var loop : Bool;
  117. /**
  118. Is a `Boolean` that reflects the `controls` HTML attribute, indicating whether user interface items for controlling the resource should be displayed.
  119. **/
  120. var controls : Bool;
  121. /**
  122. Is a `double` indicating the audio volume, from 0.0 (silent) to 1.0 (loudest).
  123. **/
  124. var volume : Float;
  125. /**
  126. Is a `Boolean` that determines whether audio is muted. `true` if the audio is muted and `false` otherwise.
  127. **/
  128. var muted : Bool;
  129. /**
  130. Is a `Boolean` that reflects the `muted` HTML attribute, which indicates whether the media element's audio output should be muted by default.
  131. **/
  132. var defaultMuted : Bool;
  133. /**
  134. Is a `AudioTrackList` that lists the `AudioTrack` objects contained in the element.
  135. **/
  136. var audioTracks(default,null) : AudioTrackList;
  137. /**
  138. Returns the list of `VideoTrack` objects contained in the element.
  139. Note: Gecko supports only single track playback, and the parsing of tracks' metadata is only available for media with the Ogg container format.
  140. **/
  141. var videoTracks(default,null) : VideoTrackList;
  142. /**
  143. Returns the list of `TextTrack` objects contained in the element.
  144. **/
  145. var textTracks(default,null) : TextTrackList;
  146. /**
  147. Is a `MediaStream` representing the media to play or that has played in the current `HTMLMediaElement`.
  148. **/
  149. var srcObject : MediaStream;
  150. /**
  151. Resets the media element and restarts the media resource. Any pending events are discarded. How much media data is fetched is still affected by the `preload` attribute. This method can be useful for releasing resources after any `src` attribute and `source` element descendants have been removed. Otherwise, it is usually unnecessary to use this method, unless required to rescan `source` element children after dynamic changes.
  152. **/
  153. function load() : Void;
  154. /**
  155. Determines whether the specified media type can be played back.
  156. **/
  157. function canPlayType( type : String ) : String;
  158. /** @throws DOMError */
  159. /**
  160. Directly seeks to the given time.
  161. **/
  162. function fastSeek( time : Float ) : Void;
  163. /** @throws DOMError */
  164. /**
  165. Begins playback of the media.
  166. **/
  167. function play() : Void;
  168. /** @throws DOMError */
  169. /**
  170. Pauses the media playback.
  171. **/
  172. function pause() : Void;
  173. /**
  174. Adds a text track (such as a track for subtitles) to a media element.
  175. **/
  176. function addTextTrack( kind : TextTrackKind, ?label : String = "", ?language : String = "" ) : TextTrack;
  177. }