I think this is the bug in the OS. But I know how I can workaround this, I will call onStart if it hasn’t been called before during the first call of onProgress. Wait for an update.
Nice. I hadn’t thought of that fallback. I guess I could have done that from the corona side but it’s nicer to have built into the plugin.
Will you post in here when you add the onStart workaround? Or shall I keep an eye on the docs on your website?
I’ll mention it here.
anyone test on ios 9.3?my app work well on ios 9.2.X,after i update to ios 9.3,it don’t work.
i got it,it is not ios problem,it is new text version.i must add init().
Thanks for figuring this out. I was afraid iOS 9.3 broke something.
Updated the plugin. Fixed iOS bug when onStart is not being called.
Thanks for sorting the onStart iOS bug Lerg.
Hi Sergey
I am seeing an error in the device log (see below) when running your test app although everything seems to be working OK. Is this a problem? This log is from an iPad Air running iOS 9.3 but I get the same error on an iPad Mini (series 1) running 9.3.1.
---------- Device Log Starts ----------
[Device] Platform: iPad / iPad4,1 / 9.3 / Apple A7 GPU / OpenGL ES 2.0 Apple A7 GPU - 77.14 / 2016.2850 / en-GB | GB | en_GB | en
[Device] Init callback
[Device] |AXSpeechAssetDownloader|error| ASAssetQuery error fetching results (for com.apple.MobileAsset.MacinTalkVoiceAssets) Error Domain=ASError Code=21 “Unable to copy asset information” UserInfo={NSDescription=Unable to copy asset information}
[Device] Languages and voices: {
[Device] “languages”:[“ar-SA”,“cs-CZ”,“da-DK”,“de-DE”,“el-GR”,“en-AU”,“en-GB”,“en-IE”,“en-US”,“en-ZA”,“es-ES”,“es-MX”,“fi-FI”,“fr-CA”,“fr-FR”,“he-IL”,“hi-IN”,“hu-HU”,“id-ID”,“it-IT”,“ja-JP”,“ko-KR”,“nl-BE”,“nl-NL”,“no-NO”,“pl-PL”,“pt-BR”,“pt-PT”,“ro-RO”,“ru-RU”,“sk-SK”,“sv-SE”,“th-TH”,“tr-TR”,“zh-CN”,“zh-HK”,“zh-TW”],
[Device] “voices”:{
[Device] “default”:""
[Device] }
[Device] }
[Device] |AXSpeechAssetDownloader|error| ASAssetQuery error fetching results (for com.apple.MobileAsset.MacinTalkVoiceAssets) Error Domain=ASError Code=21 “Unable to copy asset information” UserInfo={NSDescription=Unable to copy asset information}
[Device] Building MacinTalk voice for asset: (null)
[Device] Speech “1804289383” has started.
[Device] Speech “1804289383” progress: Nobody
[Device] Speech “1804289383” progress: expects
[Device] Speech “1804289383” progress: the
[Device] Speech “1804289383” progress: Spanish
[Device] Speech “1804289383” progress: Inquisition!
[Device] Speech “1804289383” progress: Our
[Device] Speech “1804289383” progress: chief
[Device] Speech “1804289383” progress: weapon
[Device] Speech “1804289383” progress: is
[Device] Speech “1804289383” progress: surprise,
[Device] Speech “1804289383” progress: surprise
[Device] Speech “1804289383” progress: and
[Device] Speech “1804289383” progress: fear,
[Device] Speech “1804289383” progress: fear
[Device] Speech “1804289383” progress: and
[Device] Speech “1804289383” progress: surprise,
[Device] Speech “1804289383” progress: our
[Device] Speech “1804289383” progress: two
[Device] Speech “1804289383” progress: weapons
[Device] Speech “1804289383” progress: are
[Device] Speech “1804289383” progress: fear
[Device] Speech “1804289383” progress: and
[Device] Speech “1804289383” progress: surprise,
[Device] Speech “1804289383” progress: and
[Device] Speech “1804289383” progress: ruthless
[Device] Speech “1804289383” progress: efficiency.
[Device] Speech “1804289383” has ended.
@spjnowak, I don’t see it myself, but it looks like an iOS problem somehow. According to this thread http://stackoverflow.com/questions/30794082/how-do-we-solve-an-axspeechassetdownloader-error-on-ios
You need to go to Settings -> General -> Speech, and enable “Speak Selection”.
Not sure what I can do in the plugin for this.
I tried the github sample and made apk for Android without changing anything and got this error message on the device:
Runetime Error …\main.lua:65:attempt to call field init (a nil value)
texttospeech.init(function(event)
You are probably using an old Corona version, use a recent daily build.
Thanks Lerg. That fixed the problem.
Hi Lerg.
I got this crash report from my alpha testing on Android.
Last reported Today, 09:34 Reports this week 1 Reports total 1 Application version 1 1 Android version Android 5.1 1 Device Moto G with 4G LTE (1st Gen) (peregrine) 1 java.lang.RuntimeException: java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Iterator java.util.Set.iterator()' on a null object reference Java Stack Trace: plugin.texttospeech.LuaLoader.getLanguagesAndVoices(LuaLoader.java:195) plugin.texttospeech.LuaLoader$GetLanguagesAndVoicesWrapper.invoke(LuaLoader.java:386) com.ansca.corona.JavaToNativeShim.nativeResize(Native Method) com.ansca.corona.JavaToNativeShim.resize(JavaToNativeShim.java:381) com.ansca.corona.graphics.opengl.CoronaGLSurfaceView$CoronaRenderer.onSurfaceChanged(CoronaGLSurfaceView.java:378) com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1612) com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1378) stack traceback: [C]: ? [C]: in function 'getLanguagesAndVoices' ?: in main chunk
Any ideas what this could be? I hadn’t seen this when testing.
Huh, according to what I see in Android source the object I am using can’t be null, never.
But ok, will add a null check and return nil if it’s really null.
Hey Lerg.
Could the problem I posted above be to do with the voice parameter? I cannot understand what the crash report is saying but is it possible I have the wrong default string for voice?
I’m feeding in a preference voice of ‘default’ as a starting point because the user is later given the option to change this in the settings.
It’s hard to test because this crash report was sent to me from one of my alpha testers and I don’t have that particular device at my studio.
Good idea to return nil if it’s really null though.
local preferences = { language = 'en-GB', voice = nil, -- What should this be for Android 5.0+ ? rate = 0.8, pitch = 0.8, volume = 1.0, } texttospeech.speak( phrase, { language = preferences.language, voice = preferences.voice, rate = preferences.rate, pitch = preferences.pitch, volume = preferences.volume, id = phrase, onStart = speakOnStart, onComplete = speakOnComplete } )
@juliusbangert, no, the crash is in getLanguagesAndVoices() function, not in speak().
voice parameter can be one of the strings that are returned from the getLanguagesAndVoices().
You can simply ignore it and omit it, the default voice will be used.
Ok cool. So that is an actual bug that you know a fix for and can push an update to the plugin?
So on my settings scene there is a voice option that the user can select and this is populated by what’s returned from getLanguagesAndVoices. But as a default starting value if they don’t select anything can I pass voice = nil into the speech function?
I can fix the crash, yes, but for that device there will be no voice selection.
Everything in options table for speak is optional. You can have either nil or ‘default’ for the voice parameter.
Thanks Lerg.
For now, is there a fix I can make to prevent the null bug from happening in getLanguagesAndVoices? Or does it have to be change in the Java?