Skip to content

flutter_tts_improved support on gphonex86arm mobile emulator #6

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

Open
starzar opened this issue Mar 2, 2021 · 1 comment
Open

flutter_tts_improved support on gphonex86arm mobile emulator #6

starzar opened this issue Mar 2, 2021 · 1 comment

Comments

@starzar
Copy link

starzar commented Mar 2, 2021

For crossplatform apps (Android/Windows desktop) , Android Studio(Windows10/64bit) runs scripts on Windows/Gphonex86arm mobile emulator.

On running a Flutter_tts_improved package script for a text-to-speech supported crossplatform app, the Gphonex86arm mobile emulator doesn't recognise tts supported languages and voices .

On trying to switch to the Pixel-android emulator ,AndroidStudio defaults to Gphonex86arm emulator.

Is there any way to run the tts engine without having to uninstall the Windows/ Gphonex86arm emulator ?

ERROR :

W/TextToSpeech( 6955): isLanguageAvailable failed: not bound to TTS engine
W/TextToSpeech( 6955): getVoices failed: not bound to TTS engine
D/TTS     ( 6955): getVoices: Attempt to invoke interface method 'java.util.Iterator java.util.Set.iterator()' on a null object reference

CODE :

import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:flutter_tts_improved/flutter_tts_improved.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  u/override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';
  FlutterTtsImproved tts = FlutterTtsImproved();


  u/override
  void initState() {
    super.initState();
    initPlatformState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

    await tts.setLanguage("en-US");
    await tts.setSpeechRate(1.0);
    await tts.setVolume(1.0);
    await tts.setPitch(1.0);

   

    print('VOICES: ${await tts.getVoices}');
    print('LANGUAGES: ${await tts.getLanguages}');

    tts.setProgressHandler((String words, int start, int end, String word) async{


      setState(() {
        _platformVersion = word;
      });
      print('PROGRESS: $word => $start - $end');
    });
  }

  u/override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: <Widget>[
              Padding(
                padding: const EdgeInsets.only(bottom: 20),
                child: RaisedButton(
                  onPressed: () {
                    tts.speak('say something that we can debug please');
                  },
                  child: Text('Say Something...'),
                ),
              ),
              Text('Running on: $_platformVersion\n'),
            ],
          ),
        ),
      ),
    );
  }
}
@starzar
Copy link
Author

starzar commented Mar 2, 2021

I do not have access to an Android phone right now,so just wanted to confirm if it was possible to run tts on an emulator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant