-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can I get VOSK-IOS connected to flutter? #2
Comments
You need to mail us at [email protected] and provide information about your project and will share the build. |
Hi @nshmyrev, We got the package through email. Thanks |
as flutter/dart support FFI, if you provide that implementation you can support iOS, android, linux, windows and Mac for free with one implementation could be huge ^^ |
@jaumard thank you, we'd love to have it as well. Working on iOS now |
hello,@nshmyrev |
Publication of Flutter-iOS demo will be extremely appreciated! |
+1 for working iOS example :) awesome work! |
@nshmyrev |
@nshmyrev I sent an email but haven't heard back. Is getting the iOS demo still a possibility? |
@wunderbrick I'm sorry I can't associate you with the emails we've got. If you haven't got the link already, drop another email please with your github account mentioned. |
its ok, most guys who request the package get it. No need for access keys, the library is fully offline. |
@nshmyrev Thanks for your reply. I sent another email as a reply to my original email with my Github username. My email address is the Tutanota address that starts with lambda. |
What is the recommended way to integrate the vosk ios build into a flutter app? |
@jtdLab |
Hi thanks for the reply. I obtained the iOS library. When attempting to use the .h file describing the API through FFI, i encountered missing symbols "image not found" error thrown by Following this here's what I've tried:
# To learn more about a Podspec, see http://guides.cocoapods.org/syntax/podspec.html
Pod::Spec.new do |s|
s.name = 'vosk_flutter'
s.version = '0.0.1'
s.summary = 'An iOS implementation of the vosk plugin.'
s.description = <<-DESC
An iOS implementation of the vosk plugin.
DESC
s.homepage = 'http://example.com'
s.license = { :type => 'BSD', :file => '../LICENSE' }
s.author = { 'Your Company' => '[email protected]' }
# This ensures that the source files in Classes/ are included in the native builds of apps using this FFI plugin. Podspec does not support relative paths, so Classes contains a forwarder C file that relatively imports `../../vosk-api/src/*` so that the C sources can be shared among all target platforms.
s.source = { :path => '.' }
s.public_header_files = 'Classes/**/*.h'
s.dependency 'Flutter'
s.platform = :ios, '9.0'
# Flutter.framework does not contain an i386 slice.
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
s.swift_version = '5.0'
s.vendored_frameworks = 'Frameworks/libvosk.xcframework'
end In Dart, I only edited Inside While investigating the current Android implementation, I'm also considering mirroring it, as it seems to use multiple threads. Is this required to not get lags in the UI? |
@jtdLab And you'll have something like this in Dart: String libraryPath;
if (Platform.isLinux || Platform.isIOS) {
libraryPath = Platform.environment['LIBVOSK_PATH']!;
} .... Thirdly, yes, we use multiple threads in Android to not block the main thread. Btw, there's a branch with Android FFI implemented. |
@sergsavchuk Thanks a lot for the response Pod::Spec.new do |s|
s.name = 'libvosk'
s.version = '0.3.38'
s.summary = 'Vosk iOS.'
s.description = "Vosk for iOS."
s.homepage = 'http://example.com'
s.license = { :type => 'BSD', :file => '../LICENSE' }
s.author = { 'Your Company' => '[email protected]' }
s.platform = :ios, '9.0'
s.source = { :http => "https://alphacephei.com/path/to/vosk/api.zip" }
s.vendored_frameworks = "**/libvosk.xcframework"
end Hint: Same result when using to include the binaries but its not getting added to the pods projects. I also had to put the The Pod::Spec.new do |s|
s.name = 'vosk_flutter'
s.version = '0.0.1'
s.summary = 'An iOS implementation of the vosk plugin.'
s.description = <<-DESC
An iOS implementation of the vosk plugin.
DESC
s.homepage = 'http://example.com'
s.license = { :type => 'BSD', :file => '../LICENSE' }
s.author = { 'Your Company' => '[email protected]' }
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.dependency 'Flutter'
s.dependency 'libvosk'
s.platform = :ios, '11.0'
# Flutter.framework does not contain an i386 slice.
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
s.swift_version = '5.0'
end The import Flutter
public class VoskFlutterPlugin: NSObject, FlutterPlugin {
public static func register(with registrar: FlutterPluginRegistrar) {
setenv("LIBVOSK_PATH", Bundle.main.privateFrameworksPath! + "/libvosk.framework/libvosk", 0);
let channel = FlutterMethodChannel(name: "vosk_flutter", binaryMessenger: registrar.messenger())
let instance = VoskFlutterPlugin()
registrar.addMethodCallDelegate(instance, channel: channel)
}
} The ...
flutter:
plugin:
platforms:
...
ios:
pluginClass: VoskFlutterPlugin
ffiPlugin: true
... Hint: To read the env var set on the native side from dart i had to use stdlibc instead of if (Platform.isLinux || Platform.isIOS) {
libraryPath = getenv('LIBVOSK_PATH')!;
} Help would be appreciated. |
@nshmyrev is it possible to get a version of vosk-ios containing dynamic libs instead of static ones. Dart FFI seems to not support static libs. |
Hi, can I get the iOS library, please? Last week I sent the request to the email mentioned above, but not response yet. |
I am also interested in iOS support by this plugin. @jtdLab do you mind sharing a repo with the changes you tried? I can play with it as well to see if we can make it work |
Hi,
How can I get VOSK-IOS connected to flutter?
Thank you
The text was updated successfully, but these errors were encountered: