hyperloop-modules / titanium-speech

Use the iOS 10 SFSpeechRecognizer API in JavaScript with Appcelerator Hyperloop.
21 stars 9 forks source link

*** -[NSURL initFileURLWithPath:]: nil string parameter #8

Open jasonkneen opened 6 years ago

jasonkneen commented 6 years ago

Unable to use recognition based on an existing file. Whatever the file URL is set to I get:

*** -[NSURL initFileURLWithPath:]: nil string parameter

Have Tried:

all fail with the same error.

jasonkneen commented 6 years ago

seems local file works, but can't use it with nativePath or a remote URL so

file:///Users/jkneen/Library/Developer/CoreSimulator/Devices/DF3E928C-1CD8-4DEA-9E5B-37272E8B5900/data/Containers/Data/Application/0DDC2CD8-574E-47C6-9EA6-FFA7037DECBE/tmp/85E7.mp4

fails with that error.

jasonkneen commented 6 years ago

OK got it, so it's type is URL but it's doing additional stuff to it in the module. If you pass a complete URL it needs to be:

soundURL = NSURL.URLWithString(args.url);

not

NSURL.fileURLWithPath

So suggest we have 3 types:

var SOURCE_TYPE_URL = 'url';
var SOURCE_TYPE_MICROPHONE = 'microphone';
var SOURCE_TYPE_FILENAME = 'filename';