MediaRecorder.hx 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * Copyright (C)2005-2019 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\MediaRecorder.webidl. Do not edit!
  23. package js.html;
  24. /**
  25. The `MediaRecorder` interface of the MediaStream Recording API provides functionality to easily record media. It is created using the `MediaRecorder()` constructor.
  26. Documentation [MediaRecorder](https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder$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/MediaRecorder>
  28. **/
  29. @:native("MediaRecorder")
  30. extern class MediaRecorder extends EventTarget {
  31. static function isTypeSupported( type : String ) : Bool;
  32. /**
  33. Returns the stream that was passed into the constructor when the `MediaRecorder` was created.
  34. **/
  35. var stream(default,null) : MediaStream;
  36. /**
  37. Returns the current state of the `MediaRecorder` object (`inactive`, `recording`, or `paused`.)
  38. **/
  39. var state(default,null) : RecordingState;
  40. /**
  41. Returns the MIME type that was selected as the recording container for the `MediaRecorder` object when it was created.
  42. **/
  43. var mimeType(default,null) : String;
  44. var ondataavailable : haxe.Constraints.Function;
  45. var onerror : haxe.Constraints.Function;
  46. var onstart : haxe.Constraints.Function;
  47. var onstop : haxe.Constraints.Function;
  48. var onwarning : haxe.Constraints.Function;
  49. /** @throws DOMError */
  50. @:overload( function( stream : MediaStream, ?options : MediaRecorderOptions ) : Void {} )
  51. function new( node : js.html.audio.AudioNode, output : Int = 0, ?options : MediaRecorderOptions ) : Void;
  52. /**
  53. Begins recording media; this method can optionally be passed a `timeslice` argument with a value in milliseconds. If this is specified, the media will be captured in separate chunks of that duration, rather than the default behavior of recording the media in a single large chunk.
  54. @throws DOMError
  55. **/
  56. function start( ?timeSlice : Int ) : Void;
  57. /**
  58. Stops recording, at which point a `dataavailable` event containing the final `Blob` of saved data is fired. No more recording occurs.
  59. @throws DOMError
  60. **/
  61. function stop() : Void;
  62. /**
  63. Pauses the recording of media.
  64. @throws DOMError
  65. **/
  66. function pause() : Void;
  67. /**
  68. Resumes recording of media after having been paused.
  69. @throws DOMError
  70. **/
  71. function resume() : Void;
  72. /**
  73. Requests a `Blob` containing the saved data received thus far (or since the last time `requestData()` was called. After calling this method, recording continues, but in a new `Blob`.
  74. @throws DOMError
  75. **/
  76. function requestData() : Void;
  77. }