GithubHelp home page GithubHelp logo

Comments (18)

kayabilgehan avatar kayabilgehan commented on June 30, 2024 1

We have same problem. Can you share the solution with us, if you fixed the issue?

from speech-and-text-unity-ios-android.

kayabilgehan avatar kayabilgehan commented on June 30, 2024 1

@medinags you have to make this changes in android studio with java like @PersistantStudio said.

from speech-and-text-unity-ios-android.

Aneeb151 avatar Aneeb151 commented on June 30, 2024 1

SpeechToTextPlugin.jar.zip
Anybody suffering from this problem can first update their files from the repository to latest (specially SpeechToText.cs and TextToSpeech.cs) and then replace their jar file from "Assets/Plugins/Android/SpeechToTextPlugin.jar". I have followed and updated @kayabilgehan solution as it had a type casting error and compiled the files from android studio.
Thanks @PersistantStudio and @kayabilgehan for your efforts :)

from speech-and-text-unity-ios-android.

hojjatabdollahi avatar hojjatabdollahi commented on June 30, 2024

We are having the same issue. The app crashes if you try to hide the pop up. But it works fine if you show the pop up (which covers the whole app).

Did anybody come up with any solutions to this?

from speech-and-text-unity-ios-android.

PersistantStudio avatar PersistantStudio commented on June 30, 2024

We were able to fix the problem, wich is pretty simple to adress
Just adding null checks ans size check before accessing the entry 0 in the array in OnResults & OnPartialResults.

   public void onResults(Bundle results) {
            ArrayList<String> text = results.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
            if(text != null && text.size() >0) {
            UnityPlayer.UnitySendMessage("SpeechToText", "onResults", text.get(0));
            }
        }
        @Override
        public void onPartialResults(Bundle partialResults) {
            ArrayList<String> text = partialResults.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
            if(text != null && text.size() >0) {
            UnityPlayer.UnitySendMessage("SpeechToText", "onPartialResults", text.get(0));
            }
        }`
```
The hardest part was in fact to build the plugin thas is really outdated. It's way easier to start from scratch in fact. 

> 

from speech-and-text-unity-ios-android.

hojjatabdollahi avatar hojjatabdollahi commented on June 30, 2024

@PersistantStudio , Thank you.

It took us a whole day to get android studio to compile this. We had already added a check on text.size() but adding the check for null fixed the crash. That being said, our app is now stuck, which I assume is because if the if is not true (the text is empty) nothing is sent to Unity. We are working on fixing this by sending an empty string. Maybe that works!!

Thanks again.

from speech-and-text-unity-ios-android.

PersistantStudio avatar PersistantStudio commented on June 30, 2024

I think we encountered the same issue.The call are made by name on gameobject on the Java side, so the name in Unity3D need to match the one defined in the Java plugin. The code on this repo contains an error in the way the game object is named in Unity : It is actually named TextToSpeech instead of SpeechToText when you use the lazy instanciation. Correcting this error will fix the issue of not getting any callbacks.

from speech-and-text-unity-ios-android.

kayabilgehan avatar kayabilgehan commented on June 30, 2024

We fixed the issue by storing the text created in "onPartialResults" in a variable and if the data comes from "onResults" is null, than we use the stored text data.
Code:

private Intent intent;

String partialStringResult = ""; //variable to store text from onPartialResults

@OverRide
public void onCreate(Bundle savedInstanceState) {

.
.
.

@OverRide
public void onResults(Bundle results) {
ArrayList text = results.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
if(text != null && text.size() > 0) {
UnityPlayer.UnitySendMessage("SpeechToText", "onResults", text.get(0));
}
else if(partialStringResult != null && !partialStringResult.equals("")) {
UnityPlayer.UnitySendMessage("SpeechToText", "onResults", partialStringResult); //send unity the stored string
}

}
@OverRide
public void onPartialResults(Bundle partialResults) {
ArrayList text = partialResults.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
if(text != null && text.size() > 0) {
partialStringResult = text.get(0); //store data to use it if needed
UnityPlayer.UnitySendMessage("SpeechToText", "onPartialResults", text.get(0));
}
}

Edit:
After these changes in Java I made changes below too in build.gradle in app level.

task deleteOldJar(type: Delete) {
delete 'release/SpeechToTextPlugin.jar'
}

//task to export content as jar
task exportJar(type: Copy) {
from('build/intermediates/compile_library_classes_jar/release/')
into('release/')
include('classes.jar')
rename('classes.jar', 'SpeechToTextPlugin.jar')
}

exportJar.dependsOn(deleteOldJar, build)

from speech-and-text-unity-ios-android.

medinags avatar medinags commented on June 30, 2024

@kayabilgehan Thanks for your solution, but my question is where should I implement this solution, in Unity?

from speech-and-text-unity-ios-android.

PersistantStudio avatar PersistantStudio commented on June 30, 2024

Nope the modifications needs to be made in the java project of the plugin.

from speech-and-text-unity-ios-android.

takijemai avatar takijemai commented on June 30, 2024

hello, sorry i have the same question, i m new with unity and i do this task, where i can found the java project of the plugin please?

from speech-and-text-unity-ios-android.

pedropll98 avatar pedropll98 commented on June 30, 2024

I have the same problem and when I installed Android Studio it told me that I need HAXM to work, but my computer does not meet the requirements. What can I do to edit the plugin?

from speech-and-text-unity-ios-android.

pedropll98 avatar pedropll98 commented on June 30, 2024

Can anyone share the plugin already fixed?

from speech-and-text-unity-ios-android.

takijemai avatar takijemai commented on June 30, 2024

SpeechToTextPlugin.jar.zip Anybody suffering from this problem can first update their files from the repository to latest (specially SpeechToText.cs and TextToSpeech.cs) and then replace their jar file from "Assets/Plugins/Android/SpeechToTextPlugin.jar". I have followed and updated @kayabilgehan solution as it had a type casting error and compiled the files from android studio. Thanks @PersistantStudio and @kayabilgehan for your efforts :)

hello ,thank you for the reply but even i change the jar file and update the two files of textspeech and speechtotext it's does'nt work

from speech-and-text-unity-ios-android.

Sukanta-Patra avatar Sukanta-Patra commented on June 30, 2024

SpeechToTextPlugin.jar.zip Anybody suffering from this problem can first update their files from the repository to latest (specially SpeechToText.cs and TextToSpeech.cs) and then replace their jar file from "Assets/Plugins/Android/SpeechToTextPlugin.jar". I have followed and updated @kayabilgehan solution as it had a type casting error and compiled the files from android studio. Thanks @PersistantStudio and @kayabilgehan for your efforts :)

This fixed the issue. Thank you so much man! <3

from speech-and-text-unity-ios-android.

GSJuan avatar GSJuan commented on June 30, 2024

SpeechToTextPlugin.jar.zip Anybody suffering from this problem can first update their files from the repository to latest (specially SpeechToText.cs and TextToSpeech.cs) and then replace their jar file from "Assets/Plugins/Android/SpeechToTextPlugin.jar". I have followed and updated @kayabilgehan solution as it had a type casting error and compiled the files from android studio. Thanks @PersistantStudio and @kayabilgehan for your efforts :)

Saved my life @Aneeb151. Thank you very much!

from speech-and-text-unity-ios-android.

usamaqh avatar usamaqh commented on June 30, 2024

SpeechToTextPlugin.jar.zip Anybody suffering from this problem can first update their files from the repository to latest (specially SpeechToText.cs and TextToSpeech.cs) and then replace their jar file from "Assets/Plugins/Android/SpeechToTextPlugin.jar". I have followed and updated @kayabilgehan solution as it had a type casting error and compiled the files from android studio. Thanks @PersistantStudio and @kayabilgehan for your efforts :)

Thanks a lot brother!

from speech-and-text-unity-ios-android.

Blindsp0t-creative avatar Blindsp0t-creative commented on June 30, 2024

SpeechToTextPlugin.jar.zip Anybody suffering from this problem can first update their files from the repository to latest (specially SpeechToText.cs and TextToSpeech.cs) and then replace their jar file from "Assets/Plugins/Android/SpeechToTextPlugin.jar". I have followed and updated @kayabilgehan solution as it had a type casting error and compiled the files from android studio. Thanks @PersistantStudio and @kayabilgehan for your efforts :)

Thank you so much for this !!

from speech-and-text-unity-ios-android.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.