Skip to content
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

[flutter_tts] PlatformException (Invalid Operation) when play has been canceled #87

Closed
swift-kim opened this issue May 4, 2021 · 6 comments · Fixed by #140
Closed
Labels
bug Something isn't working

Comments

@swift-kim
Copy link
Member

How to reproduce:

  1. Launch the example app. (I used a TV 6.0 emulator.)
  2. Enter some text in the text field and click PLAY, and then click STOP or PAUSE while the audio is playing.
  3. Click PLAY again and see this error message:
I/ConsoleMessage(11739): flutter: Playing
I/ConsoleMessage(11739): flutter: Cancel
E/ConsoleMessage(11739): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: PlatformException(Invalid Operation, Invalid Operation, null, null)
E/ConsoleMessage(11739): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:581:7)
E/ConsoleMessage(11739): #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:158:18)
E/ConsoleMessage(11739): <asynchronous suspension>
E/ConsoleMessage(11739): #2      _MyAppState._speak (package:flutter_tts_tizen_example/main.dart:90:9)
E/ConsoleMessage(11739): <asynchronous suspension>

cc @rookiejava @flutter-tizen/maintainers

@rookiejava
Copy link
Contributor

Which binary did you test with? I couldn't reproduced on mobile emulator.
When it comes TV profile, as mentioned in the PR, I couldn't check on the emulator. But when I checked it on the real target, I couldn't reproduce it. Test binary I tested is as follows.

Model=Tizen6/TV;
Build=latest;
Release=latest;
[Build]
Type=eng;
Date=20201111_193150;
Time=19:31:50;
Variant=NONE;

It may be a binary issue or a platform issue.

@swift-kim
Copy link
Member Author

@rookiejava I tested on various devices (R800/TM1/TV emulator) and they all have the same issue. Here is the full log:

I/FlutterTtsTizenPlugin(32517): /home/swift/Git/flutter/plugins/packages/flutter_tts/tizen/src/flutter_tts_tizen_plugin.cc: HandleMethodCall(152) > method : getLanguages
I/FlutterTtsTizenPlugin(32517): /home/swift/Git/flutter/plugins/packages/flutter_tts/tizen/src/flutter_tts_tizen_plugin.cc: HandleMethodCall(152) > method : stop
I/FlutterTtsTizenPlugin(32517): /home/swift/Git/flutter/plugins/packages/flutter_tts/tizen/src/flutter_tts_tizen_plugin.cc: OnStateChanged(259) > [TTS] State is changed (1) to (1)
I/FlutterTtsTizenPlugin(32517): /home/swift/Git/flutter/plugins/packages/flutter_tts/tizen/src/flutter_tts_tizen_plugin.cc: HandleMethodCall(152) > method : setSpeechRate
I/FlutterTtsTizenPlugin(32517): /home/swift/Git/flutter/plugins/packages/flutter_tts/tizen/src/flutter_tts_tizen_plugin.cc: HandleMethodCall(152) > method : awaitSpeakCompletion
I/FlutterTtsTizenPlugin(32517): /home/swift/Git/flutter/plugins/packages/flutter_tts/tizen/src/flutter_tts_tizen_plugin.cc: HandleMethodCall(152) > method : speak
I/FlutterTtsTizenPlugin(32517): /home/swift/Git/flutter/plugins/packages/flutter_tts/tizen/src/flutter_tts_tizen_plugin.cc: OnStateChanged(259) > [TTS] State is changed (1) to (2)
I/ConsoleMessage(32517): flutter: Playing
I/FlutterTtsTizenPlugin(32517): /home/swift/Git/flutter/plugins/packages/flutter_tts/tizen/src/flutter_tts_tizen_plugin.cc: HandleMethodCall(152) > method : getLanguages
I/FlutterTtsTizenPlugin(32517): /home/swift/Git/flutter/plugins/packages/flutter_tts/tizen/src/flutter_tts_tizen_plugin.cc: HandleMethodCall(152) > method : stop
I/FlutterTtsTizenPlugin(32517): /home/swift/Git/flutter/plugins/packages/flutter_tts/tizen/src/flutter_tts_tizen_plugin.cc: OnStateChanged(259) > [TTS] State is changed (2) to (1)
I/ConsoleMessage(32517): flutter: Cancel
I/FlutterTtsTizenPlugin(32517): /home/swift/Git/flutter/plugins/packages/flutter_tts/tizen/src/flutter_tts_tizen_plugin.cc: HandleMethodCall(152) > method : getLanguages
I/FlutterTtsTizenPlugin(32517): /home/swift/Git/flutter/plugins/packages/flutter_tts/tizen/src/flutter_tts_tizen_plugin.cc: HandleMethodCall(152) > method : setSpeechRate
I/FlutterTtsTizenPlugin(32517): /home/swift/Git/flutter/plugins/packages/flutter_tts/tizen/src/flutter_tts_tizen_plugin.cc: HandleMethodCall(152) > method : awaitSpeakCompletion
I/FlutterTtsTizenPlugin(32517): /home/swift/Git/flutter/plugins/packages/flutter_tts/tizen/src/flutter_tts_tizen_plugin.cc: HandleMethodCall(152) > method : speak
E/FlutterTtsTizenPlugin(32517): /home/swift/Git/flutter/plugins/packages/flutter_tts/tizen/src/flutter_tts_tizen_plugin.cc: HandleMethodCall(167) > [TTS] : You cannot speak again while speaking.
E/ConsoleMessage(32517): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: PlatformException(Invalid Operation, Invalid Operation, null, null)
E/ConsoleMessage(32517): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:581)
E/ConsoleMessage(32517): #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:158)
E/ConsoleMessage(32517): <asynchronous suspension>
E/ConsoleMessage(32517): #2      _MyAppState._speak (package:flutter_tts_tizen_example/main.dart:90)
E/ConsoleMessage(32517): <asynchronous suspension>
E/ConsoleMessage(32517):

Maybe the m_speaking value is not being updated properly when stop or pause is received.

@rookiejava
Copy link
Contributor

Ok. I'll check again. But tell me exactly what binary you tested.

@rookiejava
Copy link
Contributor

Ah, you're saying that the app doesn't terminated abnormally, but there's an error. Anyway, let me check again.

@swift-kim
Copy link
Member Author

The important part is the second step. I clicked the STOP (PAUSE) button before speaking ended.

@swift-kim swift-kim changed the title [flutter_tts] PlatformException (Invalid Operation) when play is canceled [flutter_tts] PlatformException (Invalid Operation) when play has been canceled May 11, 2021
@swift-kim swift-kim added the bug Something isn't working label Jun 22, 2021
bbrto21 added a commit to bbrto21/plugins that referenced this issue Jun 30, 2021
* Fix flutter-tizen#87

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
bbrto21 added a commit to bbrto21/plugins that referenced this issue Jun 30, 2021
* Fix flutter-tizen#87

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
bwikbs pushed a commit that referenced this issue Jul 5, 2021
…140)

* [flutter_tts] Manage a speaking state on the state changed callback

* Fix #87

Signed-off-by: Boram Bae <boram21.bae@samsung.com>

* [flutter_tts] Send result if await enabled

Co-authored-by: Swift Kim <swift.kim@samsung.com>
Signed-off-by: Boram Bae <boram21.bae@samsung.com>

Co-authored-by: Swift Kim <swift.kim@samsung.com>
@swift-kim
Copy link
Member Author

Note: The change hasn't been published on pub.dev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants