RNSound.setSpeed
Getting error using "setSpeed" from javascript on release version running on android device. Not seeing error when running on emulator in development.
Android react-native 0.44.0
Error:
I/ReactNativeJS( 2980): GETTING = null
E/MediaPlayer( 2980): Should have subtitle controller already set
W/dalvikvm( 2980): threadid=13: thread exiting with uncaught exception (group=0x4156eba8)
E/AndroidRuntime( 2980): FATAL EXCEPTION: mqt_native_modules
E/AndroidRuntime( 2980): Process: com.cogplay, PID: 2980
E/AndroidRuntime( 2980): java.lang.RuntimeException: Could not invoke RNSound.setSpeed
E/AndroidRuntime( 2980): at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:382)
E/AndroidRuntime( 2980): at com.facebook.react.cxxbridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:138)
E/AndroidRuntime( 2980): at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
E/AndroidRuntime( 2980): at android.os.Handler.handleCallback(Handler.java:733)
E/AndroidRuntime( 2980): at android.os.Handler.dispatchMessage(Handler.java:95)
E/AndroidRuntime( 2980): at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
E/AndroidRuntime( 2980): at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime( 2980): at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:208)
E/AndroidRuntime( 2980): at java.lang.Thread.run(Thread.java:841)
E/AndroidRuntime( 2980): Caused by: java.lang.reflect.InvocationTargetException
E/AndroidRuntime( 2980): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 2980): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 2980): at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:368)
E/AndroidRuntime( 2980): ... 8 more
E/AndroidRuntime( 2980): Caused by: java.lang.NoSuchMethodError: android.media.MediaPlayer.getPlaybackParams
E/AndroidRuntime( 2980): at com.zmxv.RNSound.RNSoundModule.setSpeed(RNSoundModule.java:161)
E/AndroidRuntime( 2980): ... 11 more
cc: @twitwi @benvium
Any updates?
Android "speed" is listed as both working and not working. Should this work?
Listed as available in both iOS and Android, from the readme.md table:

But the description lower down says iOS only:

Which version of Android are you using? The android.media.MediaPlayer.getPlaybackParams() method is available since Android 6.0 (API Level 23), so it could have something to do with this.
@lukecwilliams I created a new issue for your question. #257
@trepidity thanks!
+1 Release build on Android 4.42
RNSoundModule.java line 215 com.zmxv.RNSound.RNSoundModule.setSpeed
"react": "^16.2.0",
"react-native": "^0.53.3",
"react-native-sound": "v0.10.2",
Crashlytics

@ghsdh3409 Are you experiencing this issue...?
@esutton Android setSpeed works in the API level >= 23.
@ghsdh3409 Thank you! My mistake.
Also I was using react-native-sound v0.10.2 which I see did not check API level.
Unfortunately I did not test on an older device until after I had made the release and started receiving crashlytics reports.
@trepidity In my case, I prefer the current behavior that returns without crashing.
But I can see the other case too; throw exception so developer who ** tests ** on older devices will know setSpeed does nothing.
Now that I look at this code, I wish it had been written without the “return”. Would anyone want to write a PR and write it without the return?
On Mar 10, 2018, at 9:40 AM, Eddie [email protected] wrote:
@ghsdh3409 Thank you! My mistake.
Not sure why it threw an exception since it looked like it should have returned on an API 19 device rather than throwing?
@ReactMethod public void setSpeed(final Double key, final Float speed) { if (android.os.Build.VERSION.SDK_INT < 23) { Log.w("RNSoundModule", "setSpeed ignored due to sdk limit"); return; }
MediaPlayer player = this.playerPool.get(key); if (player != null) { player.setPlaybackParams(player.getPlaybackParams().setSpeed(speed)); }}
https://github.com/zmxv/react-native-sound/blob/253a35ca6841b8087081ec2d3565cbd2f3ea9612/android/src/main/java/com/zmxv/RNSound/RNSoundModule.java#L355
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
@esutton any update on this issue, we are also facing this issue on android version greater than 4, like android 10,6 and 9.