SpeechRecognition.hx 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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\SpeechRecognition.webidl. Do not edit!
  23. package js.html;
  24. /**
  25. The `SpeechRecognition` interface of the Web Speech API is the controller interface for the recognition service; this also handles the `SpeechRecognitionEvent` sent from the recognition service.
  26. Documentation [SpeechRecognition](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition$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/SpeechRecognition>
  28. **/
  29. @:native("SpeechRecognition")
  30. extern class SpeechRecognition extends EventTarget {
  31. /**
  32. Returns and sets a collection of `SpeechGrammar` objects that represent the grammars that will be understood by the current `SpeechRecognition`.
  33. **/
  34. var grammars : SpeechGrammarList;
  35. /**
  36. Returns and sets the language of the current `SpeechRecognition`. If not specified, this defaults to the HTML `lang` attribute value, or the user agent's language setting if that isn't set either.
  37. **/
  38. var lang : String;
  39. /**
  40. Controls whether continuous results are returned for each recognition, or only a single result. Defaults to single (`false`.)
  41. **/
  42. var continuous : Bool;
  43. /**
  44. Controls whether interim results should be returned (`true`) or not (`false`.) Interim results are results that are not yet final (e.g. the `SpeechRecognitionResult.isFinal` property is `false`.)
  45. **/
  46. var interimResults : Bool;
  47. /**
  48. Sets the maximum number of `SpeechRecognitionAlternative`s provided per result. The default value is 1.
  49. **/
  50. var maxAlternatives : Int;
  51. /**
  52. Specifies the location of the speech recognition service used by the current `SpeechRecognition` to handle the actual recognition. The default is the user agent's default speech service.
  53. **/
  54. var serviceURI : String;
  55. /**
  56. Fired when the user agent has started to capture audio.
  57. **/
  58. var onaudiostart : haxe.Constraints.Function;
  59. /**
  60. Fired when any sound — recognisable speech or not — has been detected.
  61. **/
  62. var onsoundstart : haxe.Constraints.Function;
  63. /**
  64. Fired when sound that is recognised by the speech recognition service as speech has been detected.
  65. **/
  66. var onspeechstart : haxe.Constraints.Function;
  67. /**
  68. Fired when speech recognised by the speech recognition service has stopped being detected.
  69. **/
  70. var onspeechend : haxe.Constraints.Function;
  71. /**
  72. Fired when any sound — recognisable speech or not — has stopped being detected.
  73. **/
  74. var onsoundend : haxe.Constraints.Function;
  75. /**
  76. Fired when the user agent has finished capturing audio.
  77. **/
  78. var onaudioend : haxe.Constraints.Function;
  79. /**
  80. Fired when the speech recognition service returns a result — a word or phrase has been positively recognized and this has been communicated back to the app.
  81. **/
  82. var onresult : haxe.Constraints.Function;
  83. /**
  84. Fired when the speech recognition service returns a final result with no significant recognition. This may involve some degree of recognition, which doesn't meet or exceed the `SpeechRecognitionAlternative.confidence` threshold.
  85. **/
  86. var onnomatch : haxe.Constraints.Function;
  87. /**
  88. Fired when a speech recognition error occurs.
  89. **/
  90. var onerror : haxe.Constraints.Function;
  91. /**
  92. Fired when the speech recognition service has begun listening to incoming audio with intent to recognize grammars associated with the current `SpeechRecognition`.
  93. **/
  94. var onstart : haxe.Constraints.Function;
  95. /**
  96. Fired when the speech recognition service has disconnected.
  97. **/
  98. var onend : haxe.Constraints.Function;
  99. /** @throws DOMError */
  100. function new() : Void;
  101. /**
  102. Starts the speech recognition service listening to incoming audio with intent to recognize grammars associated with the current `SpeechRecognition`.
  103. @throws DOMError
  104. **/
  105. function start( ?stream : MediaStream ) : Void;
  106. /**
  107. Stops the speech recognition service from listening to incoming audio, and attempts to return a `SpeechRecognitionResult` using the audio captured so far.
  108. **/
  109. function stop() : Void;
  110. /**
  111. Stops the speech recognition service from listening to incoming audio, and doesn't attempt to return a `SpeechRecognitionResult`.
  112. **/
  113. function abort() : Void;
  114. }