From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../api/speechrecognition/continuous/index.html | 101 +++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 files/ja/web/api/speechrecognition/continuous/index.html (limited to 'files/ja/web/api/speechrecognition/continuous') diff --git a/files/ja/web/api/speechrecognition/continuous/index.html b/files/ja/web/api/speechrecognition/continuous/index.html new file mode 100644 index 0000000000..a135333f7a --- /dev/null +++ b/files/ja/web/api/speechrecognition/continuous/index.html @@ -0,0 +1,101 @@ +--- +title: SpeechRecognition.continuous +slug: Web/API/SpeechRecognition/continuous +tags: + - API + - Experimental + - Property + - Reference + - SpeechRecognition + - Web Speech API + - continuous + - recognition + - speech +translation_of: Web/API/SpeechRecognition/continuous +--- +
{{APIRef("Web Speech API")}}{{SeeCompatTable}}
+ +

{{domxref("SpeechRecognition")}} インターフェイスの continuous プロパティは、認識が行われるたびに、継続的に結果を返すのか、あるいは1つの結果のみ返すのかを制御するようになります。

+ +

既定では1つの結果です (false)

+ +

構文

+ +
var myContinuous = mySpeechRecognition.continuous;
+mySpeechRecognition.continuous = true;
+
+ +

+ +

現在の SpeechRecognition の継続の状態を表す {{domxref("Boolean")}} 型。true の場合は継続的で、false の場合は1つのみの返しです。

+ +

+ +

下記のソースコードは Speech color changer を参考しています

+ +
var grammar = '#JSGF V1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;'
+var recognition = new SpeechRecognition();
+var speechRecognitionList = new SpeechGrammarList();
+speechRecognitionList.addFromString(grammar, 1);
+recognition.grammars = speechRecognitionList;
+//recognition.continuous = false;
+recognition.lang = 'ja-JP';
+recognition.interimResults = false;
+recognition.maxAlternatives = 1;
+
+...
+ +

注意: 現在 continuous は Gecko で実装されておらず、いつも1つを返します。今のところ、継続的な返しをエミュレートするには、下記のソースコードのように何か返す結果が取れた時に、{{domxref("SpeechRecognition.start()")}} を実行します。

+ +
recognition.onresult = function(event) {
+    ...
+  recognition.start();
+}
+ +

仕様

+ + + + + + + + + + + + + + +
仕様状態コメント
{{SpecName('Web Speech API', '#dfn-continuous', 'continuous')}}{{Spec2('Web Speech API')}}
+ +

ブラウザー実装状況

+ +
+ + +

{{Compat("api.SpeechRecognition.continuous")}}

+ +

Firefox OS の権限

+
+ +

アプリで音声認識を利用する前に、下記の権限を manifest に追加する必要があります。

+ +
"permissions": {
+  "audio-capture" : {
+    "description" : "Audio capture"
+  },
+  "speech-recognition" : {
+    "description" : "Speech recognition"
+  }
+}
+ +

privileged アプリ権限も必要なので、下記も追加が必要です。

+ +
  "type": "privileged"
+ +

関連情報

+ + -- cgit v1.2.3-54-g00ecf