capacitor-community / speech-recognition

MIT License
79 stars 43 forks source link

bug: No match and Client side error gives not snowing transcript #89

Open codexuz opened 3 weeks ago

codexuz commented 3 weeks ago

Plugin version:

Platform(s):

Current behavior:

Expected behavior:

Steps to reproduce:

Related code:

insert short code snippets here

Other information:

Capacitor doctor:

insert the output from `npx cap doctor` here
codexuz commented 2 weeks ago
<script setup>
import { ref, onMounted } from 'vue'
import { useSpeechRecognition } from '@vueuse/core'
import { useUserMedia } from '@vueuse/core'
import { AVMedia } from 'vue-audio-visual';
import { mic } from 'ionicons/icons';
import { SpeechRecognition } from "@capacitor-community/speech-recognition";

const { stream, enabled  } = useUserMedia({
  constraints: { audio:true },
})

const showBar = ref(false)
const speechResult = ref('')

  async function startRecognition() {
    const { available } = await SpeechRecognition.available();

    if (available) {
      await SpeechRecognition.start({
        language: "en-US",
        partialResults: false,
        popup: false
      });

          // listen to partial results
      SpeechRecognition.addListener("partialResults", (data) => {
        if(data.matches && data.matches.length > 0){
          speechResult.value = data.matches[0];
          console.log(speechResult.value)
        }

      });

    }

}

onMounted( async () => {
const  { permission }  = await SpeechRecognition.hasPermission();
console.log(permission)
if(!permission){
  await SpeechRecognition.requestPermission();
  await SpeechRecognition.requestPermissions();
}
})

</script>

Platform: Android

Version: ^5.36.0

Capacitor Doctor:

   Capacitor Doctor

Latest Dependencies:       

  @capacitor/cli: 6.0.0    
  @capacitor/core: 6.0.0   
  @capacitor/android: 6.0.0
  @capacitor/ios: 6.0.0    

Installed Dependencies:    

  @capacitor/ios: 6.0.0    
  @capacitor/cli: 6.0.0    
  @capacitor/core: 6.0.0   
  @capacitor/android: 6.0.0