Tau: Bug on Android when startRecorder called

Created on 22 Jan 2019  Â·  7Comments  Â·  Source: Canardoux/tau

Version of flutter_sound

1.2.4

flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.0.0, on Mac OS X 10.14.1 18B75, locale en-CA)
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
[✓] Android Studio (version 3.2)
[✓] Connected device (1 available)
• No issues found!

Platforms you faced the error (IOS or Android or both?)

This Error accurs on Android.

Expected behavior

Expected behavior is it would start recording audio

Actual behavior

Error Shows with this:

E/MethodChannel#flutter_sound(13084): Failed to handle method call
E/MethodChannel#flutter_sound(13084): java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.Integer
E/MethodChannel#flutter_sound(13084): at com.dooboolab.fluttersound.FlutterSoundPlugin.onMethodCall(FlutterSoundPlugin.java:62)
E/MethodChannel#flutter_sound(13084): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:200)
E/MethodChannel#flutter_sound(13084): at io.flutter.view.FlutterNativeView.handlePlatformMessage(FlutterNativeView.java:163)
E/MethodChannel#flutter_sound(13084): at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#flutter_sound(13084): at android.os.MessageQueue.next(MessageQueue.java:326)
E/MethodChannel#flutter_sound(13084): at android.os.Looper.loop(Looper.java:160)
E/MethodChannel#flutter_sound(13084): at android.app.ActivityThread.main(ActivityThread.java:6669)
E/MethodChannel#flutter_sound(13084): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#flutter_sound(13084): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
E/MethodChannel#flutter_sound(13084): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
E/flutter (13084): [ERROR:flutter/shell/common/shell.cc(184)] Dart Error: Unhandled exception:
E/flutter (13084): Exception: PlatformException(error, java.lang.Double cannot be cast to java.lang.Integer, null)
E/flutter (13084): #0 FlutterSound.startRecorder (package:flutter_sound/flutter_sound.dart:102:7)
E/flutter (13084):
E/flutter (13084): #1 _RecordingPageState._onRecordPressed (package:speechdb/ui/recording_page.dart:217:35)
E/flutter (13084):
E/flutter (13084): #2 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:507:14)
E/flutter (13084): #3 _InkResponseState.build. (package:flutter/src/material/ink_well.dart:562:30)
E/flutter (13084): #4 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102:24)
E/flutter (13084): #5 TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:242:9)
E/flutter (13084): #6 TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:175:7)
E/flutter (13084): #7 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:315:9)
E/flutter (13084): #8 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:73:12)
E/flutter (13084): #9 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:101:11)
E/flutter (13084): #10 _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:180:19)
E/flutter (13084): #11 _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:158:22)
E/flutter (13084): #12 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:138:7)
E/flutter (13084): #13 _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:101:7)
E/flutter (13084): #14 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:85:7)
E/flutter (13084): #15 _invoke1 (dart:ui/hooks.dart:168:13)
E/flutter (13084): #16 _dispatchPointerDataPacket (dart:ui/hooks.dart:122:5)

Tested environment (Emulator? Real Device?)

Emulator and Real Device

Steps to reproduce the behavior

When I call: path = await flutterSound.startRecorder(filename);

bug

Most helpful comment

I think I found the problem under flutter_sound/android/src/main/java/com/dooboolab/fluttersound/AudioInterface.java
int sampleRate needs to be double rather than int.

Or in flutter_sound/lib/flutter_sound.dart
change double sampleRate = 44100.0 to int sampleRate = 44100

All 7 comments

I think I found the problem under flutter_sound/android/src/main/java/com/dooboolab/fluttersound/AudioInterface.java
int sampleRate needs to be double rather than int.

Or in flutter_sound/lib/flutter_sound.dart
change double sampleRate = 44100.0 to int sampleRate = 44100

I have same problem

Same here! 😣

+1

I am still facing this issue
Need Help

Please fill a new issue with all the informations needed.

Was this page helpful?
0 / 5 - 0 ratings