audio_waveforms icon indicating copy to clipboard operation
audio_waveforms copied to clipboard

Android volume exception : .ClassCastException: java.lang.Double cannot be cast to java.lang.Float

Open Nico3652 opened this issue 3 years ago • 0 comments

Thanks a lot for this great package.

However while I tried to use

if (playerController.playerState == PlayerState.playing) {
       playerController.setVolume(0.0);
}

I got an error cast from android with double & float :

I/flutter (32185): │ ⛔ Error from outside Flutter : PlatformException(error, java.lang.Double cannot be cast to java.lang.Float, null, java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.Float
I/flutter (32185): │ ⛔ 	at com.simform.audio_waveforms.AudioWaveformsPlugin.onMethodCall(AudioWaveformsPlugin.kt:124)
I/flutter (32185): │ ⛔ 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
I/flutter (32185): │ ⛔ 	at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
I/flutter (32185): │ ⛔ 	at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
I/flutter (32185): │ ⛔ 	at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
I/flutter (32185): │ ⛔ 	at android.os.Handler.handleCallback(Handler.java:938)
I/flutter (32185): │ ⛔ 	at android.os.Handler.dispatchMessage(Handler.java:99)
I/flutter (32185): │ ⛔ 	at android.os.Looper.loop(Looper.java:250)
I/flutter (32185): │ ⛔ 	at android.app.ActivityThread.main(ActivityThread.java:7755)
I/flutter (32185): │ ⛔ 	at java.lang.reflect.Method.invoke(Native Method)
I/flutter (32185): │ ⛔ 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
I/flutter (32185): │ ⛔ 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958)
I/flutter (32185): │ ⛔ ) 
I/flutter (32185): │ ⛔  #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:653:7)
I/flutter (32185): │ ⛔ #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:296:18)
I/flutter (32185): │ ⛔ <asynchronous suspension>
I/flutter (32185): │ ⛔ #2      AudioWaveformsInterface.setVolume (package:audio_waveforms/src/base/audio_waveforms_interface.dart:132:18)
I/flutter (32185): │ ⛔ <asynchronous suspension>
I/flutter (32185): │ ⛔ #3      PlayerController.setVolume (package:audio_waveforms/src/controllers/player_controller.dart:158:20)
I/flutter (32185): │ ⛔ <asynchronous suspension>
I/flutter (32185): │ ⛔ 
I/flutter (32185): 

I tried with int and double but got the same result Thanks for any help

Nico3652 avatar Sep 20 '22 17:09 Nico3652