MediaElement.hx 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. /*
  2. * Copyright (C)2005-2013 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, do not edit!
  23. package js.html;
  24. /** HTML media elements (such as <code><a rel="custom" href="https://developer.mozilla.org/en/HTML/Element/audio">&lt;audio&gt;</a></code>
  25. and <code><a rel="custom" href="https://developer.mozilla.org/en/HTML/Element/video">&lt;video&gt;</a></code>
  26. ) expose the <code>HTMLMediaElement</code> interface which provides special properties and methods (beyond the regular <a href="/api/js/html/Element" rel="internal">element</a> object interface they also have available to them by inheritance) for manipulating the layout and presentation of media elements.<br><br>
  27. Documentation for this class was provided by <a href="https://developer.mozilla.org/en/DOM/HTMLMediaElement">MDN</a>. */
  28. @:native("HTMLMediaElement")
  29. extern class MediaElement extends Element
  30. {
  31. /** Data is available for the current playback position, but not enough to actually play more than one frame. */
  32. static inline var HAVE_CURRENT_DATA : Int = 2;
  33. /** Enough data is available—and the download rate is high enough—that the media can be played through to the end without interruption. */
  34. static inline var HAVE_ENOUGH_DATA : Int = 4;
  35. /** Data for the current playback position as well as for at least a little bit of time into the future is available (in other words, at least two frames of video, for example). */
  36. static inline var HAVE_FUTURE_DATA : Int = 3;
  37. /** Enough of the media resource has been retrieved that the metadata attributes are initialized.&nbsp; Seeking will no longer raise an exception. */
  38. static inline var HAVE_METADATA : Int = 1;
  39. /** No information is available about the media resource. */
  40. static inline var HAVE_NOTHING : Int = 0;
  41. static inline var NETWORK_EMPTY : Int = 0;
  42. static inline var NETWORK_IDLE : Int = 1;
  43. static inline var NETWORK_LOADING : Int = 2;
  44. static inline var NETWORK_NO_SOURCE : Int = 3;
  45. var audioDecodedByteCount(default,null) : Int;
  46. /** Reflects the
  47. <code><a rel="custom" href="https://developer.mozilla.org/en/HTML/Element/video#attr-autoplay">autoplay</a></code>
  48. HTML&nbsp;attribute, indicating whether to begin playing as soon as enough media is available. */
  49. var autoplay : Bool;
  50. /** The ranges of the media source that the browser has buffered, if any. */
  51. var buffered(default,null) : TimeRanges;
  52. var closedCaptionsVisible : Bool;
  53. var controller : MediaController;
  54. /** Reflects the
  55. <code><a rel="custom" href="https://developer.mozilla.org/en/HTML/Element/video#attr-controls">controls</a></code>
  56. HTML attribute, indicating whether user interface items for controlling the resource should be displayed. */
  57. var controls : Bool;
  58. /** The absolute URL of the chosen media resource (if, for example, the server selects a media file based on the resolution of the user's display), or an empty string if the <code>networkState</code> is <code>EMPTY</code>. */
  59. var currentSrc(default,null) : String;
  60. /** The current playback time, in seconds.&nbsp; Setting this value seeks the media to the new time. Setter throws DOMException. */
  61. var currentTime : Float;
  62. /** Reflects the
  63. <code><a rel="custom" href="https://developer.mozilla.org/en/HTML/Element/video#attr-muted">muted</a></code>
  64. HTML attribute, indicating whether the media element's audio output should be muted by default. Changing the value dynamically will not unmute the audio (it only controls the default state). */
  65. var defaultMuted : Bool;
  66. /** The default playback rate for the media.&nbsp; The Ogg backend does not support this.&nbsp; 1.0 is "normal speed," values lower than 1.0 make the media play slower than normal, higher values make it play faster.&nbsp; The value 0.0 is invalid and throws a <code>NOT_SUPPORTED_ERR</code>&nbsp;exception. */
  67. var defaultPlaybackRate : Float;
  68. /** The length of the media in seconds, or zero if no media data is available.&nbsp; If the media data is available but the length is unknown, this value is <code>NaN</code>.&nbsp; If the media is streamed and has no predefined length, the value is <code>Inf</code>. */
  69. var duration(default,null) : Float;
  70. /** Indicates whether the media element has ended playback. */
  71. var ended(default,null) : Bool;
  72. /** The media error object for the most recent error, or null if there has not been an error. */
  73. var error(default,null) : MediaError;
  74. var hasClosedCaptions(default,null) : Bool;
  75. var initialTime(default,null) : Float;
  76. /** Reflects the
  77. <code><a rel="custom" href="https://developer.mozilla.org/en/HTML/Element/video#attr-loop">loop</a></code>
  78. HTML&nbsp;attribute, indicating whether the media element should start over when it reaches the end. */
  79. var loop : Bool;
  80. var mediaGroup : String;
  81. /** <code>true</code> if the audio is muted, and <code>false</code> otherwise. */
  82. var muted : Bool;
  83. /** <p>The current state of fetching the media over the network.</p> <table class="standard-table"> <tbody> <tr> <td class="header">Constant</td> <td class="header">Value</td> <td class="header">Description</td> </tr> <tr> <td><code>EMPTY</code></td> <td>0</td> <td>There is no data yet.&nbsp; The <code>readyState</code> is also <code>HAVE_NOTHING</code>.</td> </tr> <tr> <td><code>LOADING</code></td> <td>1</td> <td>The media is loading.</td> </tr> <tr> <td><code>LOADED_METADATA</code></td> <td>2</td> <td>The media's metadata has been loaded.</td> </tr> <tr> <td><code>LOADED_FIRST_FRAME</code></td> <td>3</td> <td>The media's first frame has been loaded.</td> </tr> <tr> <td><code>LOADED</code></td> <td>4</td> <td>The media has been fully loaded.</td> </tr> </tbody> </table> */
  84. var networkState(default,null) : Int;
  85. var onkeyadded : EventListener;
  86. var onkeyerror : EventListener;
  87. var onkeymessage : EventListener;
  88. var onneedkey : EventListener;
  89. /** Indicates whether the media element is paused. */
  90. var paused(default,null) : Bool;
  91. /** The current rate at which the media is being played back. This is used to implement user controls for fast forward, slow motion, and so forth. The normal playback rate is multiplied by this value to obtain the current rate, so a value of 1.0 indicates normal speed.&nbsp; Not supported by the Ogg backend. */
  92. var playbackRate : Float;
  93. /** The ranges of the media source that the browser has played, if any. */
  94. var played(default,null) : TimeRanges;
  95. /** Reflects the
  96. <code><a rel="custom" href="https://developer.mozilla.org/en/HTML/Element/video#attr-preload">preload</a></code>
  97. HTML attribute, indicating what data should be preloaded at page-load time, if any. */
  98. var preload : String;
  99. var preservesPitch : Bool;
  100. /** <p>The readiness state of the media:</p> <table class="standard-table"> <tbody> <tr> <td class="header">Constant</td> <td class="header">Value</td> <td class="header">Description</td> </tr> <tr> <td><code>HAVE_NOTHING</code></td> <td>0</td> <td>No information is available about the media resource.</td> </tr> <tr> <td><code>HAVE_METADATA</code></td> <td>1</td> <td>Enough of the media resource has been retrieved that the metadata attributes are initialized.&nbsp; Seeking will no longer raise an exception.</td> </tr> <tr> <td><code>HAVE_CURRENT_DATA</code></td> <td>2</td> <td>Data is available for the current playback position, but not enough to actually play more than one frame.</td> </tr> <tr> <td><code>HAVE_FUTURE_DATA</code></td> <td>3</td> <td>Data for the current playback position as well as for at least a little bit of time into the future is available (in other words, at least two frames of video, for example).</td> </tr> <tr> <td><code>HAVE_ENOUGH_DATA</code></td> <td>4</td> <td>Enough data is available—and the download rate is high enough—that the media can be played through to the end without interruption.</td> </tr> </tbody> </table> */
  101. var readyState(default,null) : Int;
  102. /** The time ranges that the user is able to seek to, if any. */
  103. var seekable(default,null) : TimeRanges;
  104. /** Indicates whether the media is in the process of seeking to a new position. */
  105. var seeking(default,null) : Bool;
  106. /** Reflects the
  107. <code><a rel="custom" href="https://developer.mozilla.org/en/HTML/Element/video#attr-src">src</a></code>
  108. HTML attribute, containing the URL of a media resource to use. */
  109. var src : String;
  110. /** The earliest possible position in the media, in seconds. */
  111. var startTime(default,null) : Float;
  112. var textTracks(default,null) : TextTrackList;
  113. var videoDecodedByteCount(default,null) : Int;
  114. /** The audio volume, from 0.0 (silent) to 1.0 (loudest). Setter throws DOMException. */
  115. var volume : Float;
  116. function addKey( keySystem : String, key : Uint8Array, ?initData : Uint8Array, sessionId : String ) : Void;
  117. function addTextTrack( kind : String, ?label : String, ?language : String ) : TextTrack;
  118. function canPlayType( type : String, ?keySystem : String ) : String;
  119. function cancelKeyRequest( keySystem : String, sessionId : String ) : Void;
  120. function generateKeyRequest( keySystem : String, ?initData : Uint8Array ) : Void;
  121. function load() : Void;
  122. function pause() : Void;
  123. function play() : Void;
  124. }