capacitor-microphone 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -165,10 +165,6 @@ public class CapacitorMicrophonePlugin extends Plugin implements RecognitionList
165
165
  RecognizerIntent.EXTRA_CALLING_PACKAGE,
166
166
  getActivity().getPackageName()
167
167
  );
168
- recognizerIntent.putExtra(
169
- RecognizerIntent.EXTRA_PREFER_OFFLINE,
170
- true
171
- );
172
168
  speechRecognizer.startListening(recognizerIntent);
173
169
 
174
170
  call.resolve();
@@ -266,22 +262,10 @@ public class CapacitorMicrophonePlugin extends Plugin implements RecognitionList
266
262
 
267
263
  if (!isListening || isDestroyed) return;
268
264
 
269
- if (error == SpeechRecognizer.ERROR_RECOGNIZER_BUSY) {
270
- handler.postDelayed(this::restartRecognition, 300);
271
- return;
272
- }
273
-
274
- // Retry on timeout / no match
275
- if (error == SpeechRecognizer.ERROR_NO_MATCH ||
276
- error == SpeechRecognizer.ERROR_SPEECH_TIMEOUT) {
277
-
278
- handler.postDelayed(this::restartRecognition, 100);
279
- return;
280
- }
281
-
282
- stopSpeech();
265
+ handler.postDelayed(this::restartRecognition, 300);
283
266
  }
284
267
 
268
+
285
269
  @Override
286
270
  protected void handleOnDestroy() {
287
271
  isDestroyed = true;
@@ -294,7 +278,12 @@ public class CapacitorMicrophonePlugin extends Plugin implements RecognitionList
294
278
  @Override public void onBeginningOfSpeech() {}
295
279
  @Override public void onRmsChanged(float rmsdB) {}
296
280
  @Override public void onBufferReceived(byte[] buffer) {}
297
- @Override public void onEndOfSpeech() {}
281
+ @Override
282
+ public void onEndOfSpeech() {
283
+ if (!isListening || isDestroyed) return;
284
+
285
+ handler.postDelayed(this::restartRecognition, 100);
286
+ }
298
287
  @Override public void onEvent(int eventType, @Nullable android.os.Bundle params) {}
299
288
 
300
289
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capacitor-microphone",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "plugin to use the microphone",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",