Closed codexuz closed 5 months 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
closing as invalid since it's not clear what the problem is
please, when reporting issues fill the template and provide all the required information, including a sample app that reproduces the code, not just a snippet of code
Plugin version:
Platform(s):
Current behavior:
Expected behavior:
Steps to reproduce:
Related code:
Other information:
Capacitor doctor: